将大型.sql文件导入MySQL时出错

问题描述:

我正在尝试将备份.sql文件导入MySQL。我尝试过使用phpmyadmin,但这不允许我的大文件。

I am trying to import my backup .sql file into MySQL. I've tried using phpmyadmin, but that didn't allow my large sized file.

我的文件大小是243 MB。我在php.ini上做了改动。问题出在1.1M记录之外,它只导入了600k记录。我也尝试使用MySQL控制台使用命令。同样的事情也发生了。我正在使用MySQL Workbench,它向我显示以下错误。

My file size is 243 MB. I've made changes in php.ini. The problem is out of 1.1M records, its importing only 600k records. I've tried with MySQL console also using command. Same thing happened with that also. I am using MySQL Workbench, and it showed me below error.

ERROR at line 695259: Unknown command '\a'.
Finished executing script
Operation failed with exitcode 1 

这是什么意思?如何导入完整数据?

What does this mean? How do I import my full data?

< br /> 标签的存在转储文件的尾部表示您可能已使用phpmyadmin创建它,并且在转储正在进行时页面超时。因此,错误不在您的导入过程中,而是在您的转储过程中。

The presence of the <br/> tag at the tail of your dump file indicates that you have probably used phpmyadmin to create it and the the page timed out while the dump was in progress. Thus the error is not in your import process but in your dump process.

如何解决此问题?全球解决方案是使用 set_time_limit 增加php脚本执行时间另一种方法是使用mysql控制台客户端通过传递phpmyadmin来创建转储。

How can this be fixed? A global solution is to increase the php script execution time with set_time_limit an alternative is to use the mysql console client to create the dump by passing phpmyadmin.

一个有点tedius但可行的解决方案是一次转储一个表。这并不总是有效(例如,如果一个表构成数据库的大部分大小,它可能仍会导致超时)

A somewhat tedius but workable solution is to dump one table at a time. This doesn't always work (for example if one table makes up most of the size of the database it might still cause a timeout)