Generic filters
Exact matches only
Search in title
Filter by Custom Post Type
Search in project

Too many connections for the database

When you are seeing a message about too many connections for the database in the Atavism logs or in the console, verify that you have the max_connections parameter high enough for your database. It should be at least 200, but you can freely set it to 1000 or 2000 for complex installations.

To verify this parameter just log into the database using a command line, or your preferred database management tool like MySQL Workbench or HeidiSQL and invoke this query

SHOW VARIABLES LIKE 'max_connections'

as you can see we have a value of 151, we need to change it to 2000. You can do this by editing your mysqld.cnf file that on Ubuntu resides in /etc/mysql/mysql.conf.d/mysqld.cnf
Uncomment or add a line in the [mysqld] section

max_connections = 2000

and restart the MySQL server.

sudo systemctl restart mysql

Important Note: On some systems like Ubuntu/Debian you might have to also increase your service max open files parameter by editing the MySQL service file. To verify this, in the MySQL console or database management tool, invoke this query.

show global variables like '%open_files_limit%';

Increase this parameter to 20000 by uncommenting/editing or adding a new entry in the [Service] section, like this

[Service]
LimitNOFILE=20000

then restart your database service by invoking this command.

sudo systemctl restart mysql