修改原因
2020-10-07 08:29:19.690 ERROR [Druid-ConnectionPool-Create-643290333] [com.alibaba.druid.pool.DruidDataSource] [Line:2552] -> create connection SQLException, url: jdbc:mysql://127.0.0.1:3306/test?Unicode=true&characterEncoding=UTF-8&useSSL=false, errorCode 1040, state 08004
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"
目前解决办法
先临时修改连接数
#修改连接数
#设置连接数
set global max_connections=2000;
#查询连接数
show variables like 'max_connections';
#查询错误连接数 连接数包括错误连接数 即错误连接数不可超过连接数数量
show variables like '%max_connect_errors%';
再修改my.cnf
配置文件防止下次启动失效
...
[mysqld]
...
max_connections=2000
max_connect_errors=1000
...