Communications link failure mysql自动停止 连接拒绝 mysqld dead but sub。。。
服务器环境中
JAVA 连接数据库 Communications link failure, Contection refused
网上很多这种情况,解决基本上是将127.0.0.1换成localhost
但是我这个比较傻b,原因也很无奈。值得纪念,以下是我解决的过程,过程还是值得学习的。
1、症状:java 连接数据库 访问拒绝 连接拒绝。
原因:基本上是围绕着 IP,PORT,DB,USERNAME,PASSWORD这几个参数,只能是这里出了问题。
过程:将127.0.0.1换成localhost,还是不行,修改timeout时间也不行(如果修改超时时间就可以了,你应该查看是什么原因造成连接时间过长)
原因:原来是数据库停止了,是IP参数造成的。
为什么mysql停止了呢?
2、症状:java连接数据库,出现 mysqld killed。。(比较隐蔽,一般看不到)查看mysql状态,显示mysql dead。。
原因:一般正常来说,mysqld是被mysqld_safe管理的,mysqld_safe相当于一个守护进程,一般mysql出现错误,停止后,mysqld_safe会自动重启mysql
然而,mysqld 却 dead 了,这显然不正常,说明mysqld_safe没有重启mysql,或重启失败了。
过程:查看mysqld_safe日志,确实显示重启失败。
原因:内存不够了。。。。。。。
原来,mysql启动时会创建一个默认128M的缓冲池,当时服务器上跑的程序太多了,连128M都分不出来了。
解决:升级服务器,关闭不需要的程序,调低mysql buffer pool 大小
Communications link failure mysql自动停止 连接拒绝 mysqld dead but sub。。。的更多相关文章
- 解决MySQL连接超时Communications link failure due to underlying exception
最近在用一个MySQL的Java连接池的过程中,连接一晚上不释放,第二天就会造成超时的错误,查了一下原因,原来是因为MySQL默认的空闲等待时间是8个小时,一旦空闲超过8个小时,就会抛出异常.异常文本 ...
- jdbc 连接mysql Communications link failure的解决办法
使用Connector/J连接MySQL数据库,程序运行较长时间后就会报以下错误: Communications link failure,The last packet successfully r ...
- mysql连接com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
现象:客户端连接服务器端mysql是没问题的,所有都木有问题,应用程序配置也没问题,但是连接就抛异常: com.mysql.jdbc.exceptions.jdbc4.CommunicationsEx ...
- Java连接MySQL报错:CommunicationsException: Communications link failure
现象: 报错:Exception in thread "main" com.mysql.cj.jdbc.exceptions.CommunicationsException: Co ...
- com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 解决办法
09:00:30.307 [http-8080-6] ERROR org.hibernate.transaction.JDBCTransaction -JDBC begin failed com.my ...
- Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
很长的报错,截取 ERROR c.a.d.p.DruidDataSource - discard connection com.mysql.jdbc.exceptions.jdbc4.Comm ...
- mysql 5.1超过默认8小时空闲时间解决办法(错误:com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure)
报错: MySQL第二天早上第一次连接超时报错, com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications lin ...
- Mysql Communications link failure 问题的解决
问题现象 com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last p ...
- Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure 解决
感谢大佬:https://blog.csdn.net/a704397849/article/details/93797529 springboot + mybatis多数据库 + druid连接池配置 ...
随机推荐
- python学习笔记(12):高级面向对象
一.__slots__和property 1.__slots__魔术函数动态的添加方法和属性 2.直接暴露属性的局限性 3.使用get/set方法 4.利用@property简化get/set方法 5 ...
- React与Typescript整合
0. Typescript Typescript对于前端来说可以说是越来越重要了,前端的很多项目都用Typescript进行了重构.这主要得益于Typescript有比较好的类型支持,在编码的过程中可 ...
- Form表单的主要Content-Type
在Spa单页面横行的时代,前后端交互基本都是Json交互(也有通过FormData的,比如上传文件).而在之前的Jsp,Php前后不分家的时候,前后交互好大一部分都是通过Form表单来完成的.From ...
- linux grep 设置高亮显示
[root@eric ~]# vi /etc/profile alias grep='grep --color=auto' [root@eric ~]# source /etc/profile
- QT生成可执行的EXE程序
[转载] Qt 官方开发环境使用的动态链接库方式,在发布生成的exe程序时,需要复制一大堆 dll,如果自己去复制dll,很可能丢三落四,导致exe在别的电脑里无法正常运行.因此 Qt 官方开发环境里 ...
- 【leetcode】778. Swim in Rising Water
题目如下: 解题思路:本题题干中提到了一个非常重要的前提:"You can swim infinite distance in zero time",同时也给了一个干扰条件,那就是 ...
- vue的keep-alive组件
keep-alive是Vue提供的一个抽象组件,用来对组件进行缓存,从而节省性能,由于是一个抽象组件,所以在v页面渲染完毕后不会被渲染成一个DOM元素 <keep-alive> <l ...
- C++ 单链表模板类实现
单链表的C语言描述 基本运算的算法——置空表.求表的长度.取结点.定位运算.插入运算.删除运算.建立不带头结点的单链表(头插入法建表).建立带头结点的单链表(尾插入法建表),输出带头结点的单链表 #i ...
- 二叉搜索树第k个节点
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x ...
- Intellij IDEA中如何给main方法赋args
Intellij IDEA中如何给main方法赋args 程序: package com.otherExample; /** * Created by 谭雪娇 on 2017/3/29. */publ ...