赞
踩
使用Navicat连接远程数据库的时候,发生连接错误is not allowed to connect to this mysql server。
后来查了各种资料,就是连接的用户没有远程访问权限。
处理办法,给连接的用户加上远程访问权限。
以root用户为例。
mysql -u root -p
use mysql;
select host from user where user='root';
这些是允许访问数据库的地址。我们可以追加一条也可以直接将localhost
改成%
允许所有地址使用这个
用户访问。
update user set host='%' where user = 'root' and host='localhost';
然后再查看一下这个字段的字
select host from user where user='root';
如图所示说明修改成功。最后使用命令更新设定即可。
flush privileges;
这样重新使用navicat重新连接,就可以连接成功了。
对你有帮助吗?点个赞吧~
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。