首页 > 数据库技术 > 详细

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

时间:2016-12-13 21:20:48      阅读:2074      评论:0      收藏:0      [点我收藏+]

环境:在VirtualBox中安装了Ubuntu虚拟机,网络使用了NAT模式,开启了端口转发。

技术分享

局域网内其他计算机访问虚拟机中的MySQL Server出现两个问题:

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

以及

host is not allowed to connect mysql

 

1.解决Lost connection to MySQL server at ‘reading initial communication packet, system error: 0

修改/etc/mysql/my.cnf

注释#bind-address = 127.0.0.1

在[mysqld]中加入skip-name-resolve

 

2.解决host is not allowed to connect mysql

进入mysql库:

grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘YourPassword‘ with grant option;

 

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

原文:http://www.cnblogs.com/dreamingodd/p/6171820.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!