If you get the error message "connect to mysql server 127.0.0.1: 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:

[mysqld]
......
max_connections = 500
max_user_connections = 500
.......
Tagged on:     

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

  • April 14, 2011 at 3:26 pm
    Permalink

    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.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *