Hello all,
This isn’t a strictly MySQL issue, it has to do also with PHP Apache and cPanel but I believe the core is MySQL so I decided to post it here.
Recently I had a SQLSTATE[08004] [1040] Too many connections issue. I use PHP PDO for the connection and from the PHP PDO manual I know that “PHP will automatically close the connection when your script ends”.
From phpMyAdmin information_schema GLOBAL_STATUS table I see.
ABORTED_CLIENTS 3589
ABORTED_CONNECTS 27319
From SHOW VIRABLES statement I see
max_connect_errors 20
max_connections 150
max_user_connections 25
I am thinking on how to fix the “Too many connections” issue. Should I try to set global max_connections more then 150? One other approach is to create more users for the database and then the web application to select randomly witch one to use. Would this help fixing the issue? Until know I have avoided making persistent connections with the use of PDO::ATTR_PERSISTENT should I re-examine that?
I understand that I should consider moving to VPS or Dedicated Server Hosting and maybe I will, but first I must understand how things work. In cPanel/Databases/MySQL Databases you can add new MySQL users. The max_user_connections refers to that or to cPanel account (all the users you create) ?.
Thank you in advance for your responses,