且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-06-02 22:02:44

< 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)