当前位置:数据库 > MySQL >>

Mysql “Too many connections” 的解决方法

连接数超过了 MySQL 设置的值,与 max_connections 和 wait_timeout 都有关系。wait_timeout 的值越大,连接的空闲等待就越长,这样就会造成当前连接数越大。

WINDOWS解决MYSQL Errno.: 1040错误
XXXX info: Can not connect to MySQL server
User: root
Time: 2004-5-20 3:00pm
Script: /XXXX/XXXX.php
Error: Too many connections
Errno.: 1040
An error report has been dispatched to our administrator.


解决方法:

修改 MySQL 配置文件(Windows下为 my.ini, Linux下为 my.cnf )中的参数:

 代码如下 复制代码

max_connections= 1000
wait_timeout = 5

如果没有可以自行添加,修改后重启 MySQL。


如果是linux系统我们修改

/etc/mysql/my.cnf,添加以下一行:

 代码如下 复制代码
set-variable = max_connections=500

或在启动命令中加上参数 max_connections=500

补充:数据库,mysql教程 
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,