mysql 连接池 不够用问题
2017-01-09 18:30
393 查看
原因: (1)连接后没有关闭(2)死锁(3)程序重开的连接数太多等
解决 :
(1)连接后如果不用及时关闭,
(2)手动关闭不用连接
(3) 配置mysql最大连接数
这 种方式说来很简单,只要修改MySQL配置文件my.ini 或 my.cnf的参数max_connections,将其改为max_connections=1000,然后重启MySQL即可。
解决 :
(1)连接后如果不用及时关闭,
(2)手动关闭不用连接
mysql> show processlist; +----+------+-----------+--------------------+---------+------+-------+------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+------+-----------+--------------------+---------+------+-------+------------------+ | 37 | root | localhost | information_schema | Query | 0 | NULL | show processlist | | 38 | root | localhost | NULL | Sleep | 559 | | NULL | +----+------+-----------+--------------------+---------+------+-------+------------------+ mysql> kill 40; 1 row in set (0.00 sec) mysql> use information_schema mysql> select id from processlist; +----+ | id | +----+ | 40 | +----+ 1 row in set (0.00 sec) mysql> select concat('kill ',id,';') from information_schema.processlist where user='root' into outfile '/export/yoon.txt'; Query OK, 1 row affected (0.09 sec) [root@db01 export]# more yoon.txt kill 40; 批量删除会话: mysql> source /export/yoon.txt
(3) 配置mysql最大连接数
这 种方式说来很简单,只要修改MySQL配置文件my.ini 或 my.cnf的参数max_connections,将其改为max_connections=1000,然后重启MySQL即可。
相关文章推荐
- Ibatis在mysql中获得主键与连接池技术合并的又一问题
- 用ssh框架做了个小项目,用c3p0做连接池,用的是Mysql 5.1.x ,现问题如下:
- 使用c3p0与DBCP连接池,造成的MySql 8小时问题解决方案
- 使用c3p0与DBCP连接池,造成的MySql 8小时问题解决方案
- MySQL 数据库名大小写问题 导致的c3p0连接池 出错
- nodejs + redis/mysql 连接池问题
- MySQL 连接池8小时空闲后超时问题解决
- mysql 连接池连接超时的问题
- Mysql+hibernate 长时间不操作再进入,导致连接池关闭的问题解决。
- [转]Hibernate用C3P0连接池 解决MYSQL 链接超时问题
- java数据库连接池proxool介绍及mysql8小时断开连接问题的说明
- java数据库连接池proxool介绍及mysql8小时断开连接问题的说明
- 使用c3p0与DBCP连接池,造成的MySql 8小时问题解决方案
- c3p0与DBCP连接池,造成的MySql 8小时问题解决方案
- MySQL 关于连接池用完的问题和too many connection ----解决办法
- mysql的java连接池,用openSTA测试50人并发访问一万次,没有出现问题,很好用
- 使用c3p0与DBCP连接池,造成的MySql 8小时问题解决方案
- 使用c3p0与DBCP连接池,造成的MySql 8小时问题解决方案
- C3P0连接池连接MySQL出现的问题