简体   繁体   English

MySQL 5.5 - 通过命令行导入大型sql文件的问题

[英]MySQL 5.5 - Issues importing a large sql file via command line

I have been trying for quite a while to import a large (4GB) sql dump file with the MySQL command line. 我已经尝试了很长一段时间用MySQL命令行导入一个大的(4GB)sql转储文件。 I always get a "MySQL server has gone away" error at a particular line, or if I split the file into smaller chunks (about 512 MB), I get an error about the maximum allowed packet size exceeded, again around the same line. 我总是在特定的行上得到“MySQL服务器已经消失”的错误,或者如果我将文件拆分成更小的块(大约512 MB),我得到的错误是关于超出允许的最大数据包大小,再次围绕同一行。 From what I have read, the solution is to change the max_allowed_packet size in my.ini to a large number and restart, but I have done so with no luck. 根据我的阅读,解决方案是将my.ini中的max_allowed_pa​​cket大小更改为大数并重新启动,但我没有运气。 I have also tried the import using the command line parameter, --max_allowed_packet=2147483648, no luck there either. 我也尝试使用命令行参数导入--max_allowed_pa​​cket = 2147483648,也没有运气。 Is there something else that I am missing here? 我还缺少其他的东西吗? I've exhausted all of the other forum suggestions, maybe someone has another idea I can try. 我已经用尽所有其他论坛的建议,也许有人有另一个想法,我可以尝试。 Thanks, 谢谢,

JW JW

Also, you have to change it for both the client and the daemon mysqld server. 此外,您必须为客户端和守护程序mysqld服务器更改它。 Change the my.cnf or my.ini file under the [mysqld] section and set max_allowed_packet=1000M or you could run these commands in a MySQL console connected to that same server: 更改[mysqld]部分下的my.cnf或my.ini文件并设置max_allowed_packet=1000M或者您可以在连接到同一服务器的MySQL控制台中运行这些命令:

set global net_buffer_length=1000000000; 
set global max_allowed_packet=1000000000;

Use a very large value for the packet size, because they are in bytes and then restart your MySQL server. 使用非常大的数据包大小值,因为它们以字节为单位,然后重新启动MySQL服务器。

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

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