0

I have my uncompleted website on a shared host, and while testing I had an error: >

User '...' has exceeded the 'max_connections_per_hour'(current value: 6000)

I think I should change my host on VPS, but the price is higher, so I'm trying to find a way to fix it without host changing. I know that it can be fixed by increasing amount of database users and switching them, but then I must have about 100 users to make it ok. Is there some another way?

Qirel
  • 25,449
  • 7
  • 45
  • 62
g.hagmt
  • 73
  • 5
  • 4
    `max_connections_per_hour` is the number of total connections created within an hour, not open connections, so a busy website can hit that fairly quickly. I'd suggest finding a host that does not have that limit. – aynber Nov 26 '18 at 16:28
  • https://dba.stackexchange.com/questions/156391/root-max-connections-per-hour-exceed – Emilio Gort Nov 26 '18 at 16:36
  • https://stackoverflow.com/questions/19034583/mysql-error-exceeded-the-max-connections-per-hour – Emilio Gort Nov 26 '18 at 16:36
  • As far as application design goes: you can denormalize table schemes to avoid extraneous queries, use compount queries as far as possible, a query cache of course, and foremost avoid storing application-level settings in the DB e.g. – mario Nov 26 '18 at 16:49
  • yeah, you're right, @aynber, but i was trying to find another way, like using one connection for one user, but i don't know is it possible. as i know, php automatically closes mysql connection, so i don't know how to control that. – g.hagmt Nov 26 '18 at 16:51
  • You can try persistent connections, but that will only help so far, especially if you have a max_connections limit. If you can't adjust the limit yourself, talk to your webhost to see if they'll raise it for you. Otherwise, you're between a rock and a hard place trying to get it to work. – aynber Nov 26 '18 at 16:52
  • @aynber I wrote to host support and they said that i have to change tariff, off course. But I'm not going to, so I tried that thing with users switching and it works. Like if you have 10 db users instead of 1, then max_connections_per_hour = max_connections_per_hour*10, but it's not enough. So I tried to save connection link in session variable and it decreased amount of connections,and now, new connection creating only when page reloading. But I'm not sure that it is the right decision. – g.hagmt Nov 27 '18 at 17:11

0 Answers0