码迷,mamicode.com
首页 > 数据库 > 详细

mysql拒绝连接,提示连接数太多了Too many connections

时间:2020-07-21 14:14:30      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:slist   row   struct   try   tor   variables   jdbc   ring   mysql数据库   

  日志里打印:

10: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数据库   

原文地址:https://www.cnblogs.com/wuxun1997/p/13354255.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!