MySQL Server has Gone Away in Drupal 7

2020-03-10 05:47发布

问题:

In my form field type, i edit the file menu these error will appear,

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2006 MySQL server has gone away' in D:\wamp\www\cms_development\includes\database\database.inc on line 2168 ( ! ) PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away in D:\wamp\www\cms_development\includes\database\database.inc on line 2168

Anybody Know how to rectify this error...

回答1:

This may be because of max_allowed_packet

Change in the my.ini/my.cnf file. Include the single line under [mysqld] in your file

max_allowed_packet=500M

now restart the MySQL service once you are done. You can see it's curent value in mysql like this:

SHOW VARIABLES LIKE 'max_allowed_packet'

You can read about it here http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html



回答2:

This is for Linux Users.In terminal,
Step 1:

locate my.cnf

And you copy the Path

Step 2:

sudo gedit "Paste the path"

Step 4: Changed "max_allowed_packet" from "1m" to "32m" and saved my.cnf

 sudo "path" restart

(or) Do Normal System Restart



回答3:

I had a similar problem. mysql would crash while drupal8 was going through install process. restarting mysql would eliminate the "mysql has gone away ..." error but drupal install would never finish. the following combination of mysql and apache configs provided a stable digitalocean droplet for me: https://www.digitalocean.com/community/questions/mysql-server-keeps-stopping-unexpectedly?answer=26016



标签: mysql drupal