今天在开发过程中,一个单位跑的好好的项目,在家中的Mac下运行时,遇到了下面这个错误:
 
"Lost connection to MySQL server at 'reading initial communication packet, system error: 61"
 
看错误描述应该是无法连接数据库,OK,我先检查数据库是否正常工作,phpmyadmin看了一下一切正常。
 
看了一下数据库配置:hostname 使用的是 127.0.0.1,看了一下网上的解决方案,大多是因为防火墙或者网络访问不通造成的,那我这可是127.0.0.1本地地址,按理说不会不通呀,那我就换成 localhost 试一下,结果居然好了。
 
检查一下 my.cnf 并没有任何与地址解析相关的配置,应该使用的默认配置。
 
根据 Stack Overflow 中的讨论,推论出因为默认安装的mysql绑定的地址是 localhost 所以使用IP访问时mysql的访问策略拒绝了访问,解决方法是修改 my.cnf 或者允许IP地址访问。
 
 
参考资料:
2、51Jb

Mac下遇到 'reading initial communication packet’ 问题的更多相关文章

  1. mac navicate 2013 - Lost connection to MySQL server at 'reading initial communication packet

    mac 本地mysql用navicate打开表时遇到如下错误: 2013 - Lost connection to MySQL server at 'reading initial communica ...

  2. MySQL远程连接丢失问题解决方法Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0

    最近远程连接mysql总是提示 Lost connection 很明显这是连接初始化阶段就丢失了连接的错误 其实问题很简单,都是MySQL的配置文件默认没有为远程连接配置好,只需要更改下MySQL的配 ...

  3. 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 ...

  4. 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 ...

  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连接问题: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 ...

  7. 快速解决mysql Lost connection to MySQL server at 'reading initial communication packet及can't connect to mysql server on 'localhost'

    今天在使用Navicat连一个远程mysql时,总是提示连接不成功,提示Lost connection to MySQL server at 'reading initial communicatio ...

  8. 解决Lost connection to MySQL server at 'reading initial communication packet', 的方法

    今天用heidsql连接mysql时出了问题,提示:Lost connection to MySQL server at 'reading initial communication packet 网 ...

  9. Lost connection to MySQL server at 'reading initial communication packet' 错误解决

    Lost connection to MySQL server at 'reading initial communication packet' 错误解决 上次解决了这个问题,今天又碰到,突然失忆, ...

随机推荐

  1. 基于spring的aop实现读写分离与事务配置

    项目开发中经常会遇到读写分离等多数据源配置的需求,在Java项目中可以通过Spring AOP来实现多数据源的切换. 一.Spring事务开启流程 Spring中通常通过@Transactional来 ...

  2. New line

    The concepts of line feed (LF) and carriage return (CR) are closely associated, and can be either co ...

  3. EasyUI的使用

    EasyUI包含有很多“UI控件”,实现了网页中常见的(或者是一些模拟桌面的)效果,这样我们就不用“重新造轮子”了,只要掌握了这些控件的用法,就可以容易的在网页上实现这些效果了. 所以,接下来的问题就 ...

  4. JavaSE基础第一篇

      1.JDK的安装: 包括JRE 和JVM   下载地址: www.oracle.com/www.sun.com 2.环境变量 set path = "bin所在路径" 设置pa ...

  5. Apache 打开网页的时候等待时间过长的解决方案

    服务器搭建后经常在打开页面的时候,等待很长时间,有时候,都超过一分钟了,然后才能打开,但是打开后,速度又很快,休息一会再点击,又会很慢了,遇到了这种问题很头疼,由于不是专业做服务器配置的,所以刚开始没 ...

  6. 浅析MySQL中exists与in的使用

    exists对外表用loop逐条查询,每次查询都会查看exists的条件语句,当 exists里的条件语句能够返回记录行时(无论记录行是的多少,只要能返回),条件就为真,返回当前loop到的这条记录, ...

  7. SQL Server 参数化 PARAMETERIZATION

    ALTER DATABASE  dbname  SET PARAMETERIZATION SIMPLE  --默认 ALTER DATABASE  dbname  SET PARAMETERIZATI ...

  8. CEGUI0.8.4引入到自己工程中

    首先要确定你的CEGUI已经完全编译好,若未进行这一步请参照http://www.cnblogs.com/wenguang1996/p/5027522.html 打开VS2012新建C++工程,然后添 ...

  9. 项目中如何GB2312转UTF-8

    $str = mb_convert_encoding($str, "gb2312", "UTF-8"); // 这是一个PHP 自带函数 参数1 是要转的字符, ...

  10. js Date 关于时间获取问题

    var date1 = new Date(); var timeFormat = { 'yyyy-mm-dd': date1 .toJSON().split('T')[0], //"2017 ...