Question

Got Error "MySQL server has gone away"? what is the solution for this?

I got these 2 error

  1. “Packets out of order. Expected 0 received 45. Packet size=4739923” &
  2. “SQLSTATE[HY000] [2006] MySQL server has gone away” HELP ME Same application working other server but it’s not working here, please help me.
Subscribe
Share

Waiting for your valuable suggestion, please suggest me

My PHP is in 167.99.59.63 server and database is in 45.55.34.229 server, and also added bind-address = 45.55.34.229

Connection COde ‘mysql’ => [ ‘driver’ => ‘mysql’, ‘host’ => env(‘DB_HOST’, ‘45.55.34.229’), ‘port’ => env(‘DB_PORT’, ‘25000’), ‘database’ => env(‘DB_DATABASE’, ‘g#######’), ‘username’ => env(‘DB_USERNAME’, ‘g*******’), ‘password’ => env(‘DB_PASSWORD’, ‘m########’), ‘charset’ => ‘utf8’, ‘collation’ => ‘utf8_unicode_ci’, ‘prefix’ => ‘’, ‘strict’ => false, ‘engine’ => null, ‘timezone’ => ‘+05:30’, ], //DBNAME, USERNAME, PASSWORD hide in this code

For Error Log, Check this link http://167.99.59.63/application/backend/public/

@gdlc

How are you connecting to the database? Please post the code.

You can also post the last few lines of mysql error log to help you solving the problem.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I already increased maxallowed_packet and restart mysql, but that problem is not solved. Please give any other solution to solve this issue.

Your mysql server has probably timed out and might be fixed by checking if the wait_timeout mysql variable in your mysql configuration file (my.cnf) is large enough. It could also be caused by an incorrect or a too large packet. You can fix this by increasing the packet size limit max_allowed_packet in my.cnf file. After doing above restart your mysql server.