Is a single website wreaking havoc on your MySQL server by saturating all its sockets ? If so you need to set in place some limits.
The max_user_connections variable
You are likely familiar with the max_connections
setting, but there is also the less know max_user_connections
. Its name is self-explanatory.
Limit for a specific user
If you need to be more granular, it’s also possible to limit connections for a specific user, like this:
GRANT ALL ON DBNAME.* TO XXX@YYY with MAX_USER_CONNECTIONS 100;
You can use other limit options like MAX_QUERIES_PER_HOUR
, MAX_UPDATES_PER_HOUR
or MAX_CONNECTIONS_PER_HOUR
depending your needs.