I have one site hosted with godaddy on shared hosting, it was working fine but from the last 3-4 days, sometimes it shows the error while connecting to database. So I checked the errors_log. In error log I found out this error.
PHP Warning: mysqli_connect(): (42000/1226): User 'admin' has exceeded the 'max_user_connections' resource (current value: 30) in /home/y3if63mq4u0l/public_html/classes/Database.php on line 30
So I run this query "
show global variables like '%connections%'
" to check how many connections I have available its shows me "max_connections" -> 1000 and
"max_user_connections" ->200 but in error its giving me a error on 30.
So is there anyway that I can increase the max_user_connection on shared hosting or is there any other way to solve this.
Also is there any way through which I can check, how many users are currently active and which file they are accessing. In short, I want to keep track which is taking up my resources because may be there is some problem in my coding.
What I have tried:
I contacted 'Godaddy' support they are saying me to upgrade to VPS, but actually its not my site, its my client site and he isn't ready to upgrade it to VPS or Dedicated Server.
I googled for any solution but can't find any appropriate solution.
I did manually close database connection at the end in each file