我在虚拟机安装了phpstudy,然后使用宿主机进行访问,提示报错is not allowed to connect to this mysql server
发现用本地电脑的navicat链接不上
图片如下
如果你虚拟机是linux,可以ssh登陆以后进行修改
[root@izbp10fk8pd9zjv9y2g9ajz etc]# mysql -u root -p Enter password:
管理mysql
use mysql;
select host from user where user='root';
修改帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入MySQL后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改称”%”
update user set host = '%' where user ='root';
flush privileges;
直接使用服务器上安装的phpmyadmin
如果你像我一样,在windows2008 server r2上面安装的phpstudy这样的集成包,用来编程用
可以在windows2008 上面安装一个本地的navicat或者其他工具修改,如下图
改好以后
然后就可以访问了
windows下面可能需要重启mysql
转载请注明:落伍老站长 » is not allowed to connect to this mysql server报错,phpstudy