首页 > 代码库 > 虚拟机中MySQL连接问题:Lost connection to MySQL server at 'reading initial communication packet, system error: 0 以及 host is not allowed to connect mysql
虚拟机中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 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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。