MySQL远程连接丢失问题解决方法Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0
2023-09-27 14:20:51 时间
最近远程连接mysql总是提示
Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0
很明显这是连接初始化阶段就丢失了连接的错误
其实问题很简单,都是MySQL的配置文件默认没有为远程连接配置好,只需要更改下MySQL的配置文件即可。
具体的解决步骤如下:
找到并修改my.cnf文件。在不同的Linux系统下,my.cnf放在不同的位置。这里以Ubuntu Server做示例,其他系统请根据情况自行找到my.cnf的路径。一般只会存放在/etc/my.cnf或者/etc/mysql/my.cnf下。
首先用vim打开my.cnf:
vim /etc/mysql/my.cnf
看看是否有绑定本地回环地址的配置,如果有,注释掉下面这段文字:(在文字之前加上#号即可)
bind-address = 127.0.0.1
然后找到[mysqld]部分的参数,在配置后面建立一个新行,添加下面这个参数:
skip-name-resolve
保存文件并重启MySQL:
/etc/init.d/mysql restart
这样就会发现,问题已经解决了!远程连接不会丢失了。
相关文章
- sql server使用bcp导出txt文件然后导入到mysql
- mysql-server-5.7.25的my.cnf
- Mysql 8.0 my.ini 系统变量设置--Server System Variable Reference
- 解决MySql报错:1130 - Host 'xxx' is not allowed to connect to this MySQL server的方法
- MYSQL导入CSV格式文件数据执行提示错误(ERROR 1290): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement.
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in
- Mysql连接错误:Lost connection to Mysql server at 'waiting for initial communication packet'
- 设置mysql 5.7 可以外部访问的办法
- Mysql:innodb engines:Moveing Tablespace Files when mysqld server is Offline!
- Mysql:来源于Mariadb的【审计】插件:server_audit
- Mysql mysql lost connection to server during query 问题解决方法
- mysql几种性能测试的工具使用
- can't connect to mysql server on localhost <10061>
- mysql将root用户设为所有主机可访问
- 【转载】mysql导入大批量数据出现MySQL server has gone away的解决方法
- [mysq]ERROR 2006 (HY000) at line xx: MySQL server has gone away 解决方法