MySQL “#2006 - MySQL server has gone away” in phpM

2019-06-06 14:44发布

问题:

The Problem

My MySQL database works fine for my web application. However, when I try to open the database with phpMyAdmin, I get this error message:

#2006 - MySQL server has gone away

And phpMyAdmin disconnects back to the login screen. Other databases work fine. My ax_allowed_packet is set to 16. I also tried 64, but it didn't work.

Also this error occured eventually. The database is about 3 MB in size, so not very big.

Used Software

  • Debian Squeeze x64
  • MySQL (current version)
  • phpMyAdmin (current version)

Question

How can I fix this error in order to view and edit my database in phpMyAdmin again?

回答1:

I finally found it.

Apparently, there were some incompatibility issues after upgrading to MySQL 5.6.

In order to check for such issues and fix them, you will need to do a MySQL Upgrade.

Just run the following on a terminal:

mysql_upgrade -u root -p

Enter your password, and wait until the upgrade finishes.

This fixed the problem for me.



回答2:

My Reputation is not high enough so i can't comment so i will here, mysql_upgrade -u root -p worked for me i had the same issue, after upgrading mysql, everything worked. i could could log into the database using phpmyadmin but when i tried to add a user it failed , giving MySQL “#2006 - MySQL server has gone away”, Note that i also updated phpmyadmin with yum update phpmyadmin first before running mysql_upgrade -u root -p. Now all works fine, thanks!