Too many connections
在一次启动项目的过程中报了如下一个错误信息:
[ERROR] [2019-03-20 13:14:43] com.alibaba.druid.pool.DruidDataSource.init(629) | init datasource error
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: 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:408)
at com.mysql.jdbc.Util.getInstance(Util.java:383)
意思是说链接太多了,分析下会出现这种情况的原因:
1.查看代码,是否在获取数据库连接,访问完数据库之后没有及时关闭数据库连接,释放资源
2.查看连接进程结束时间 wait_timeout — 指的是mysql在关闭一个非交互的连接之前所要等待的秒数
如果你没有修改过MySQL的配置,wait_timeout的初始值是28800
wait_timeout 过大有弊端,其体现就是MySQL里大量的SLEEP进程无法及时释放,拖累系统性能,不过也不能把这个指设置的过小,否则你可能会遭遇到“MySQL has gone away”之类的问题
3.看数据库的连接数设置,Mysql默认是100,以及增大数据库最大连接数
SHOW VARIABLES LIKE '%max_con%';
修改:(一般设置范围在500-1000之间)
SET GLOBAL max_connections = 1000;
可在MySQL配置文件my.ini直接找到对应的连接数max_connections和等待时间wait_timeout直接修改
如有需要可以加我Q群【308742428】大家一起讨论技术。
后面会不定时为大家更新文章,敬请期待。
喜欢的朋友可以关注下。
Too many connections的更多相关文章
- 解决mysql too many connections的问题
由于公司服务器上的创建的项目太多,随之创建的数据库不断地增加,在用navicat链接某一个项目的数据库时会出现too many connections ,从而导致项目连接数据库异常,致使启动失败. 为 ...
- Data source rejected establishment of connection, message from server: "Too many connections"解决办法
异常名称 //数据源拒绝从服务器建立连接.消息:"连接太多" com.MySQL.jdbc.exceptions.jdbc4.MySQLNonTransientConnection ...
- Configure Security Settings for Remote Desktop(RDP) Services Connections
catalogue . Configure Server Authentication and Encryption Levels . Configure Network Level Authenti ...
- 问题解决:psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
错误提示: psql: could not connect to server: No such file or directory Is the server running locally and ...
- Too Many Connections: How to Increase the MySQL Connection Count To Avoid This Problem
1.问题描述 在启动使用mysql数据库的项目时,遇到一个报错,如下: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConn ...
- Configure the max limit for concurrent TCP connections(转)
To keep the TCP/IP stack from taking all resources on the computer, there are different parameters t ...
- 打开mysql时,提示 1040,Too many connections
打开mysql时,提示 1040,Too many connections,这样就无法打开数据库,看不了表里边的内容了. 出现这个问题的原因是,同时对数据库的连接数过大,mysql默认的最大连接数是1 ...
- mysql连接数设置操作(Too many connections)
mysql在使用过程中,发现连接数超了~~~~ [root@linux-node1 ~]# mysql -u glance -h 192.168.1.17 -pEnter password: ERRO ...
- Too many connections解决方案
原因: my.ini 中设定的并发连接数太少或者系统繁忙导致连接数被占满. 连接数超过了 MySQL 设置的值,与 max_connections 和 wait_timeout 都有关. wait ...
- 【JDBC 报错】Connections could not be acquired from the underlying database!
项目启动报错: [2016-07-13 10:04:15,074] ERROR org.apache.ibatis.executor.BaseExecutor Could not get a data ...
随机推荐
- skyline开发——加载Shapefile文件
//1)获取道路的GroupID string dlId = ptm.FindGroupByName("道路"); IFeatureLayer66 featureLayer = n ...
- Jackson注解简介
1.注解: @JsonInclude(JsonInclude.Include.NON_NULL) 1.如果放在属性上,如果该属性为NULL则不参与序列化 ;2.如果放在类上,那对这个类的全部属性起作用 ...
- TestNG的使用方法
本文转载自于:https://blog.csdn.net/qq_24373725/article/category/7432624 TestNG介绍 TestNG是Java中的一个测试 ...
- angular点击查看更多(简单demo)
今天来跟大家分享一个小的demo,一般网页浏览到底部的时候会有一个点击加载更多的按钮,之前一直纠结怎么写这个,今天学习angular时发现可以用组件来实现这么一个小的效果,大家有兴趣的话可以看一下. ...
- SQL,group by分组后分别计算组内不同值的数量
select name as 姓名,sum( case when cargo='笔' then 1 else 0 end ) as 笔,sum( case when cargo='橡皮' then 1 ...
- C语言的数据类型的本质和提高学习
一.数据类型的概念 类型是对数据的抽象 类型是相同的数据有相同的表示形式.存储格式以及相关的操作 程序中使用的数据必定属于某一种数据类型 1.算术类型: 包括三种类型:整数类型.浮点类型,枚举型. ...
- 贪心-Wooden Sticks
先将火柴按照长度(或重量)优先排序,在不断遍历数组,找出其中重量(长度)递增子序列,并标记 Problem Description There is a pile of n wooden sticks ...
- org.apache.maven.archiver.mavenarchiver.getmanifest怎么解决
原因就是你的maven的配置文件不是最新的 1.help ->Install New Software -> add ->https://otto.takari.io/content ...
- U-Boot Makefile分析(4)具体子Makefile的分析
前面分析的都是多数Makefile要读入的文件,这次我们以drivers/mtd/nand/Makefile为例,分析一个具体的子Makefile是如何工作的. 子Makefile的结构是固定的: i ...
- iText框架(生成pdf文档)
1.创建一个itext的简单示例 a.导包(pom.xml文件) <dependencies> <dependency> <groupId>com.lowagie& ...