mysql使用localhost可以访问,使用ip地址无法访问
本地安装的mysql服务,使用localhost可以连接,ip地址发无法连接;
解决办法:
进入mysql命令界面,输入select host,user from mysql.user;
host字段所有值都是localhost,说明只允许本地访问
设置允许任意IP访问,执行语句:
mysql>update mysql.user set host = '%' where user = 'root';
mysql>flush privileges;
使用客户端工具连接测试:连接成功