mysqli::real_connect(): (HY000/1040): Too many connections

Did you ever face this error?

  1.  Packets out of order. Expected 0 received 1. Packet size=23
  2. mysqli::real_connect(): (HY000/1040): Too many connections
  3.  mysqli::real_connect(): Error while reading greeting packet.
  4. mysqli::real_connect(): (HY000/2006): MySQL server has gone away


Here is the solution for this issue:

Check MySQL connection limit in a configuration file or

Run the below command to check:

mysql -e "show variables like '%connection%';"

You will see like this:

max_connections = 500

Increase it as per you want:

max_connections = 50000

Restart the MySQL service:

service MySQL restart

Now check your website, I hope the error will not occur!

Tagged:
Sign In or Register to comment.