Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用mysql导入数据库时丢失数据_Mysql_Sql_Ubuntu - Fatal编程技术网

使用mysql导入数据库时丢失数据

使用mysql导入数据库时丢失数据,mysql,sql,ubuntu,Mysql,Sql,Ubuntu,我正在尝试使用mysql导入SQL数据库,但并不是所有的行都被导入 我使用的是Ubuntu17,mysql版本14.14,发行版5.7.26。首先,我用“mysql-u root-p”打开mysql,然后是“use db;”,然后是“source[fullpath]/db.sql”。使用此命令,我会收到错误消息: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is

我正在尝试使用mysql导入SQL数据库,但并不是所有的行都被导入

我使用的是Ubuntu17,mysql版本14.14,发行版5.7.26。首先,我用“mysql-u root-p”打开mysql,然后是“use db;”,然后是“source[fullpath]/db.sql”。使用此命令,我会收到错误消息:

ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected
不幸的是,我检查了是否所有的表都是用“showtables”导入的,并且只导入了5个表中的2个。此外,并不是第二个表中的所有行都被导入。我确定必须有5个表和X行数

为了防止这种情况,我使用了以下命令:

mysql -u root -p -h localhost -D db --binary-mode -o < [fullpath]/db.sql
sudo iconv -f utf-16 -t utf-8 db.sql > db_utf8.sql
然后尝试对“db_utf8.sql”使用“source”命令,但出现以下错误:

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    42
Current database: db

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    43
Current database: db

ERROR 2006 (HY000): MySQL server has gone away
拜托,有人知道该怎么做吗

我的同事使用的是同一个文件,对他们来说一切正常,所以可能我没有使用正确的命令


编辑:在一些问题中,有一些关于(取消)压缩文件的提示,但这一个从来没有压缩或取消压缩过。

它现在可以工作了。我很幸运,我有一个同事也尝试过同样的方法,一切都很好。所以我从那台计算机上删除了数据库,将.sql文件移到了我的计算机上,并尝试导入这个转储文件。现在一切正常。

现在正常了。我很幸运,我有一个同事也尝试过同样的方法,一切都很好。所以我从那台计算机上删除了数据库,将.sql文件移到了我的计算机上,并尝试导入这个转储文件。现在一切正常