简体   繁体   English

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

[英]Error while importing large .sql file into MySQL

I am trying to import my backup .sql file into MySQL. 我正在尝试将备份的.sql文件导入MySQL。 I've tried using phpmyadmin, but that didn't allow my large sized file. 我试过使用phpmyadmin,但是不允许我的大文件。

My file size is 243 MB. 我的文件大小是243 MB。 I've made changes in php.ini. 我在php.ini中进行了更改。 The problem is out of 1.1M records, its importing only 600k records. 问题出在110万条记录中,仅导入60万条记录。 I've tried with MySQL console also using command. 我已经尝试过MySQL控制台也使用命令。 Same thing happened with that also. 同样的事情也发生了。 I am using MySQL Workbench, and it showed me below error. 我正在使用MySQL Workbench,它向我显示以下错误。

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? 如何导入我的完整数据?

It seems dump was not properly created. 似乎转储未正确创建。 There are few errors in you sql file. sql文件中有几个错误。

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. 转储文件末尾的<br/>标记表明您可能已使用phpmyadmin创建了该文件,并且在进行转储时页面已超时。 Thus the error is not in your import process but in your dump process. 因此,错误不是在导入过程中,而是在转储过程中。

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. 全局解决方案是使用set_time_limit增加php脚本的执行时间,另一种方法是使用mysql控制台客户端通过传递phpmyadmin来创建转储。

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) 这并不总是有效(例如,如果一个表占据了数据库的大部分大小,那么它可能仍会导致超时)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM