当前位置:Gxlcms >
数据库问题 >
mysql拒绝连接,提示连接数太多了Too many connections
mysql拒绝连接,提示连接数太多了Too many connections
时间:2021-07-01 10:21:17
帮助过:29人阅读
:
39:
48.962 [Druid-ConnectionPool-Create-
1315749361] [] [] ERROR c.alibaba.druid.pool.DruidDataSource -
create connection error
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.Util.getInstance(Util.java:384)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:973)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1112)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2506)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2539)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2321)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:
832)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:
46)
at sun.reflect.GeneratedConstructorAccessor31.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1368)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1424)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:1680)
看mysql数据库实际的连接数:
mysql> show variables like ‘%max_connections%‘;
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 700 |
+-----------------+-------+
1 row in set (0.01 sec)
想看具体都有哪些连接,执行:
mysql> show full processlist;
改连接数,重启失效:
mysql> set GLOBAL max_connections=1000;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like ‘%max_connections%‘;
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+
1 row in set (0.01 sec)
真要永久修改,得去my.cnf配置文件里改max_connections属性。
mysql拒绝连接,提示连接数太多了Too many connections
标签:slist row struct try tor variables jdbc ring mysql数据库