Mysql MySQLNonTransientConnectionException: Too many connections 解决方法
作者:
dave
系统报错:
Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections
解决方法
查看当前值
[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:
版权声明:本文为博主原创文章,未经博主允许不得转载。