2006 – MySQL Server has gone away error during database imp_MySQL
I was trying to import a relatively large database into MySQL via phpMyAdmin, and I was hit with the error message 2006 – MySQL server has gone away :
Why has the server gone away? lol. Thinking it was bound to be something like a size limit ( not the first time this has happened to me ), I ran some simple SQL to print out the MySQL configuration variables:
SHOW VARIABLES;
In the resulting list, look for max_allowed_packet
:
If you convert 1048576 bytes into something perhaps more meaningful, such as MB, you’ll find it’s a low 1MB. Well, that’s certainly not a big enough limit for the database SQL I’d tried to import.
Edit the MySQL my.cnf file
So to increase this limit, I located the my.cnf file, which MAMP uses as part of the MySQL configuration setup:
sudo nano /etc/my.cnf
And added a new value to the end of the file:
max_allowed_packet = 64M
Thanks to this article for helping me understanding how to update the MySQL settings for MAMP , and this answer on * for helping me understand why I was received the 2006 sql error.
上一篇: 基于PHP实现简单的随机抽奖小程序,php抽奖小程序_PHP教程
下一篇: PHP求解,该如何解决
推荐阅读
-
ThinkPHP出现General error: 2006 MySQL server has gone away的解决方法
-
Python pandas ERROR 2006 (HY000): MySQL server has gone away
-
2006 – MySQL Server has gone away error during database imp_MySQL
-
ERROR 2006 (HY000) at line xx: MySQL server has gone away 解
-
远程连接mysql 这几天一直出现 2006 'MySQL server has gone away'
-
ERROR 2006 (HY000) at line xx: MySQL server has gone away 解
-
Python pandas ERROR 2006 (HY000): MySQL server has gone away
-
ThinkPHP出现General error: 2006 MySQL server has gone away的解决方法