[英]MySQL Too many connections error using Laravel 5.4
I have a Laravel 5.4 web app running on a shared hosting ( a2hosting ) and once every now and then I get a SQLSTATE[08004][1040] Too many connections
error. 我有一个在共享主机( a2hosting )上运行的Laravel 5.4 Web应用,一次又一次出现
SQLSTATE[08004][1040] Too many connections
错误。 Some times it takes a few minutes to start working again, some times it has taken hours. 有时需要几分钟才能重新开始工作,有时则需要数小时。
I have tried several things to diagnose the problem and to try to fix it but nothing has worked so far. 我已经尝试了几种方法来诊断问题并尝试解决问题,但到目前为止没有任何效果。
max_connections
is set to 500 and wait_timeout
is set to 8 hours. max_connections
设置为500, wait_timeout
设置为8小时。
If I log in into the mysql cli while the error is still poping out and list the active processes it show's no more than 10 ~ 15 processes. 如果在错误仍然弹出的情况下登录mysql cli并列出活动进程,则该进程显示的进程数不超过10〜15个。
Also the system is only used by some 30 people so I have no idea why the max number of connections could be reached (maybe php is not closing some connections for some reason?). 另外该系统仅由大约30个人使用,所以我不知道为什么可以达到最大连接数(也许php由于某些原因没有关闭某些连接?)。
Has anyone encountered an error like this? 有没有人遇到这样的错误? and if so what have you done to fix it?
如果是这样,您做了什么修复? Also any ideas of what could be causing the error and how to prevent/fix it?
还有关于什么可能导致该错误以及如何防止/修复该错误的任何想法?
I can provide more info on my laravel app, db, and server if it could help diagnose the problem. 如果可以帮助诊断问题,我可以在laravel应用程序,数据库和服务器上提供更多信息。
Possible causes: 可能的原因:
wait_timeout
. wait_timeout
。 wait_timeout
settings; wait_timeout
设置; you changed the wrong one.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.