MySQL 增加mysql导入大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9981098/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Increasing mysql import size
提问by Theepan K.
I am trying to import a mysql file to my cpanel phpmyadmin. But I am getting this error message. "#1153 - Got a packet bigger than 'max_allowed_packet' bytes"
我正在尝试将一个 mysql 文件导入我的 cpanel phpmyadmin。但我收到此错误消息。“#1153 - 得到一个大于 'max_allowed_packet' 字节的数据包”
I have tried putty as well. But the error message is same. I don't know how to change the mox upload size in mysql in cpanel.
我也试过腻子。但是错误信息是一样的。我不知道如何在cpanel中更改mysql中的mox上传大小。
Please help me
请帮我
Thank you so much
非常感谢
回答by Flo Doe
This error has nothing to do with the php.ini, its clearly an error message from the DBMS.
此错误与 php.ini 无关,它显然是来自 DBMS 的错误消息。
You can increase the value of the max_allowed_packet in the my.cnf file:
您可以增加 my.cnf 文件中 max_allowed_packet 的值:
[mysqld]
max_allowed_packet = 128M
After restarting your mysqld it should work (for larger data increase the value more)
重新启动 mysqld 后它应该可以工作(对于更大的数据,增加更多的值)
If you try to "import with putty", i guess your are using mysql from command line, in this case you can start mysql with the --max_allowed_packet parameter e.g:
如果您尝试“使用腻子导入”,我猜您正在从命令行使用 mysql,在这种情况下,您可以使用 --max_allowed_packet 参数启动 mysql,例如:
mysql --max_allowed_packet=128M -u root -p sampledb < dump.sql
Alternatively if you source the file from within a running mysql session you can set the parameter by:
或者,如果您从正在运行的 mysql 会话中获取文件,则可以通过以下方式设置参数:
set global max_allowed_packet=128M;
last example only is effective till next restart of mysqld, for a permanent solution stick to my first example.
最后一个示例仅在下次重新启动 mysqld 之前有效,对于永久解决方案,请坚持我的第一个示例。
回答by joschua011
php -i | grep php.ini
php -i | grep php.ini
Open the Loaded php.ini and modify "upload_max_filesize" and restart Apache (assuming u have apache)
打开已加载的 php.ini 并修改“upload_max_filesize”并重新启动 Apache(假设您有 apache)
回答by Primoz Rome
The fix is to increase the MySQL daemon's max_allowed_packet. You can do this to a running daemon by logging in as Super and running the following commands.
修复方法是增加 MySQL 守护进程的 max_allowed_packet。您可以通过以 Super 身份登录并运行以下命令来对正在运行的守护程序执行此操作。
# mysql -u admin -p
mysql> set global net_buffer_length=1000000;
Query OK, 0 rows affected (0.00 sec)
mysql> set global max_allowed_packet=1000000000;
Query OK, 0 rows affected (0.00 sec)
Then to import your dump:
然后导入您的转储:
gunzip < dump.sql.gz | mysql -u admin -p database