mySQL错误1040:太多连接 [英] mySQL Error 1040: Too Many Connection
问题描述
如何解决这些问题,SQL错误1040:太多连接
即使我尝试把
How to fix these, "SQL Error 1040: Too Many Connection" even I try to put
max_user_connection=500
仍然太多连接
推荐答案
如果你用完了这样的连接,很有可能你没有关闭你打开的连接。
If you are running out of connections like this, chances are excellent that you are not closing the connections that you have open.
检查打开连接并确保连接尽快关闭的代码。通常,您要对实现 IDisposable (包括数据库连接)的任何内容使用使用关键字,以确保这些对象在离开范围后立即处理
Review code that opens connections and ensure the connections are closed as soon as practical. Typically you want to make use of the using keyword around anything that implements IDisposable (including database connections) to ensure that such objects are disposed as soon as they leave the scope where they are needed.
您可以使用此查询检查当前活动连接数:
You can check the current number of active connections with this query:
show processlist
参考: MySQL show status - 有效连接或总连接数?
这篇关于mySQL错误1040:太多连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!