MySQL ERROR 1040: Difference between revisions
Line 42: | Line 42: | ||
$ mysql.server start | $ mysql.server start | ||
''IMPORTANT: Increasing the connections will also increase the memory usage on the server. Make sure you have enough resources before applying these changes.'' | |||
Revision as of 22:51, 26 September 2019
MySQL error 1040: Too many connections
Problem
This specific error can manifest during different circumstances. Below are two examples of such occurrences:
$ /opt/zimbra/libexec/zmdbintegrityreport -r -v /opt/zimbra/common/bin/mysqlcheck: Got error: 1040: Too many connections when trying to connect
$ /opt/zimbra/bin/zmmysqlstatus ERROR 1040 (HY000): Too many connections Error while running 'mysql --user=zimbra --password=******** --database=zimbra --batch --skip-column-names'. at /opt/zimbra/bin/zmmysqlstatus line 256.
Resolution
1. Enter mysql command line:
$ mysql
2. Once inside confirm the current setting:
show variables like "max_connections";
3. Change the current setting with higher value:
set global max_connections = 200;
4. Restart:
$ mysql.server stop $ mysql.server start
However after server restart these settings will be gone.
To make the change permanent:
1. Edit my.cnf file and under [mysqld] section change the max_connections value.
2. Restart:
$ mysql.server stop $ mysql.server start
IMPORTANT: Increasing the connections will also increase the memory usage on the server. Make sure you have enough resources before applying these changes.