The error indicates that the number of available connections for the MariaDB database server has been exhausted. To fix this issue, you need to increase the allowed number of database connections.
To do this, add or modify the following directive in the file:
/etc/mysql/my.cnf
Add it to the [mysqld]
section:
[mysqld]
max_connections = 800
For the changes to take effect, restart the service using the command:
service mariadb restart
Note: If multiple different users are connecting to the database, you should also set a connection limit for each user. This will prevent database downtime in case one user exceeds the connection limit.
Typically, a limit of 50 connections per user is more than enough. If this limit is exceeded for some reason, you should check for issues in the script, such as slow query execution.
In this case, the error message will be different:
SQLSTATE[HY000] [1203] User someuser already has more than 'max_user_connections' active connections
To prevent an overall connection limit exceedance, add the following line to the same file:
[mysqld]
max_connections = 800
max_user_connections = 50
After making these changes, restart the service:
service mariadb restart
Done.