最近远程连接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

这样就会发现,问题已经解决了!远程连接不会丢失了。

MySQL远程连接丢失问题解决方法Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0的更多相关文章

  1. Lost connection to MySQL server at ‘reading initial communication packet', system error: 0 mysql远程连接问题

    在用Navicat for MySQL远程连接mysql的时候,出现了 Lost connection to MySQL server at ‘reading initial communicatio ...

  2. mysql远程连接问题 Lost connection to MySQL server at ‘reading initial communication packet', system error: 0

    在用Navicat for MySQL远程连接mysql的时候,出现了 Lost connection to MySQL server at ‘reading initial communicatio ...

  3. 虚拟机中MySQL连接问题:Lost connection to MySQL server at 'reading initial communication packet, system error: 0 以及 host is not allowed to connect mysql

    环境:在VirtualBox中安装了Ubuntu虚拟机,网络使用了NAT模式,开启了端口转发. 局域网内其他计算机访问虚拟机中的MySQL Server出现两个问题: Lost connection ...

  4. mysql登陆时出现ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0

    有4到5天没开mysql,这天晚上打=打开phpstudy,想进去mysql练习练习,结果丢给我这个 ERROR 2013 (HY000): Lost connection to MySQL serv ...

  5. Mysql Lost connection to MySQL server at ‘reading initial communication packet', system error: 0

    在用Navicat for MySQL远程连接mysql的时候,出现了 Lost connection to MySQL server at ‘reading initial communicatio ...

  6. mysql远程连接错误提醒:2013-Lost connection to MySQL server at ‘reading initial communication packet', system error: 0

    因为没有匹配/etc/hosts.allow. 解决方法: 1.在hosts.allow 文件中添加 mysqld:ALL [root@ucDB204 ~]# cat /etc/hosts.allow ...

  7. navicat 出现 mysql远程连接问题 Lost connection to MySQL server at ‘reading initial communication packet', system error: 0

    今天做服务器上的东西需要看数据库时,突然发现有这个报错,然后自己也查了很多资料 我最后找到一个在my,cnf配置文件中mysqld下加入一条 max_allowed_packet = 500M 也就是 ...

  8. Lost connection to MySQL server at 'reading initial communication packet', system error: 0的一个解决方案

    -A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT在icmp之前/etc/init.d/iptables restar ...

  9. lost connection to mysql server at "reading initial communication packet",system error:2

随机推荐

  1. Intent(一.显示使用intent)

    大家都知道如果手机只有一个活动的应用,那这个应用也太简单了吧.如同网页一下,是有多个组成的,在C#中我们可以使用各程skip控件或代码,这里不再赘述.那么我们还是在当前的项目中创建一个名为Second ...

  2. 又一个高性能轻量级的iOS模型框架YYModel

    前言 iOS的模型框架其实有很多了,去年研究过Mantle,也了解过JSONModel.MJExtension,最近的项目项目优化的时候,再次考虑,基于轻量级.高性能的考虑,最终选择了YYModel. ...

  3. C++算法实源码分析

    includes: // TEMPLATE FUNCTION includes WITH PRED template<class _InIt1, class _InIt2, class _Pr& ...

  4. IndexOf、IndexOfAny 、Remove

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  5. SQL SERVER 中如何用脚本管理作业

    在SQL SERVER中用脚本管理作业,在绝大部分场景下,脚本都比UI界面管理作业要高效.简洁.打个简单的比方,如果你要查看作业的运行时长,如果用UI界面查看,100个作业,你就得在历史记录里面至少查 ...

  6. 关于xml的使用。

    使用的常用类: XmlSerializer ParaMapping StreamReader DirectionaryInfo FileInfo using as object 例子: public ...

  7. 搭建通过 ssh 访问的 Git 服务器

    一.Git 协议 Git 可以使用四种主要的协议来传输数据:本地传输,ssh 协议,Git 协议和 HTTP 协议. Git 使用的传输协议中最常见的就是 ssh 了.大多数环境已经支持通过 ssh ...

  8. 设计模式C#实现(十五)——命令模式

    意图 0 适用性 1 结构 2 实现 3 效果 4 参考 5 意图 将请求封装成一个对象,客户接受请求参数:可以对请求排队或者记录请求日志,以及可以支持撤销操作 适用性 抽象出待执行的动作以参数化某对 ...

  9. 【转】Linux常用命令大全

    原文地址:http://www.php100.com/html/webkaifa/Linux/2009/1106/3485.html 系统信息 arch 显示机器的处理器架构(1) uname -m ...

  10. Kafka Linux 安装

                            要先设置host, etc/hosts,添加     127.0.0.1 机器名         创建目录             修改日志保存位置   ...