当Mysql 数据库抛出如下异常
Caused by: com.mysql.cj.exceptions.CJException: 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)
意味着超出设置最大连接数了
-- show variables like 'max_connections' 151
-- show global status like 'Max_used_connections'; 152
-- set global max_connections=1000;
这是临时解决方案,当mysql 服务重启之后就失效了,
想要永久修改那么得去安装服务器上去修改 mysql 的 mysql.ini 文件 文章来源:https://www.toymoban.com/news/detail-522243.html
max_connections=1000
然后重启mysql 文章来源地址https://www.toymoban.com/news/detail-522243.html
net stop mysql;
net start mysql;
到了这里,关于Mysql “Too many connections“ 异常的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!