mysql数据库报错(Communications link failure)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql数据库报错(Communications link failure)相关的知识,希望对你有一定的参考价值。

参考技术A 原因:mysql5将其连接的等待时间(wait_timeout)缺省为8小时。
修改配置文件即可,步骤如下:
【1】登录mysql,cmd命令
mysql -h主机地址 -u用户名 -p用户密码(例如 mysql -hlocalhost -uroot -p123456)
【2】查看wait_timeout,cmd命令:
show global variables like 'wait_timeout';

【3】若wait_timeout太小,修改之。cmd命令:
set global wait_timeout=604800;
set global interactive_timeout=604800;
修改完成后,即可测试了。

以上是关于mysql数据库报错(Communications link failure)的主要内容,如果未能解决你的问题,请参考以下文章

项目启动时数据库报错:com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

Java连接MySQL报错:CommunicationsException: Communications link failure

项目启动报错:Communications link failure

druid与mysql Communications link failure

踩坑:DBCP连接池报错:Communications link failure

JDBC 报错 CommunicationsException: Communications link failure