签到成功

知道了

CNDBA社区CNDBA社区

Mysql MySQLNonTransientConnectionException: Too many connections 解决方法

2017-08-28 09:12 4511 0 原创 MySQL
作者: dave

系统报错:

http://www.cndba.cn/dave/article/2184
http://www.cndba.cn/dave/article/2184

Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections 

http://www.cndba.cn/dave/article/2184
http://www.cndba.cn/dave/article/2184


http://www.cndba.cn/dave/article/2184

http://www.cndba.cn/dave/article/2184

解决方法

http://www.cndba.cn/dave/article/2184

http://www.cndba.cn/dave/article/2184

查看当前值
[dave@www.cndba.cn bin]# mysql -ucndba -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 868
Server version: 5.1.73-log Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
mysql> show variables like "max_connections";
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 151   |
+-----------------+-------+
1 row in set (0.00 sec)

临时修改:
mysql> set global max_connections = 1000;
Query OK, 0 rows affected (0.03 sec)

mysql> show variables like '%max_connections%'; 
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 1000  |
+-----------------+-------+
1 row in set (0.00 sec)

永久修改:
修改/etc/my.cnf
在[mysqld]下面添加
[mysqld]
max_connections = 1500

然后重启mysql数据库:
[dave@www.cndba.cn etc]# service mysqld stop
停止 mysqld:                                              [确定]
[dave@www.cndba.cn etc]# service mysqld start
正在启动 mysqld:


http://www.cndba.cn/dave/article/2184
http://www.cndba.cn/dave/article/2184

版权声明:本文为博主原创文章,未经博主允许不得转载。

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
dave

dave

关注

人的一生应该是这样度过的:当他回首往事的时候,他不会因为虚度年华而悔恨,也不会因为碌碌无为而羞耻;这样,在临死的时候,他就能够说:“我的整个生命和全部精力,都已经献给世界上最壮丽的事业....."

  • 2261
    原创
  • 3
    翻译
  • 578
    转载
  • 191
    评论
  • 访问:7995319次
  • 积分:4346
  • 等级:核心会员
  • 排名:第1名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ