How to solve the too many connections error in MySQL

If you get the error message "connect to mysql server Too many connections" in a log file, e.g. the mail.log file, then the max. number of mysql database connections on your server is reached. To increase the max. number of simultaneous connections, edit the MySQL my.cnf file:

vi /etc/mysql/my.cnf

and add or change the lines for MySQL max_connections and max_user_connections in the [mysqld] section of my.cnf file:

max_connections = 500
max_user_connections = 500

1 thought on “How to solve the too many connections error in MySQL”

  1. You can also run
    SET GLOBAL max_connections = 500;
    in the mysql cli if you don’t want to restart your server.
    Ofcourse you sill need it added to my.cnf so its used on the next restart.


Leave a Comment