300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > MySQL:使用NavicatIP远程连接失败 提示“is not allowed to connect to this MySql server”

MySQL:使用NavicatIP远程连接失败 提示“is not allowed to connect to this MySql server”

时间:2021-10-04 14:07:16

相关推荐

MySQL:使用NavicatIP远程连接失败 提示“is not allowed to connect to this MySql server”

问题:

使用Navicat Premium用IP远程连接MySQL时失败,提示“is not allowed to connect to this MySql server”,但在本地用localhost代替IP访问却正常。

解决方案:

修改mysql库中的user表,将用户root对应的Host值由localhost改为%,并且重启mysql服务生效。

方法1(最简单):使用Navicat Premium本地登录修改。

在本地用localhost可以成功登录,打开mysql库下的user表,将对应root用户的Host,改为%,提交后重启mysql服务即可。

方法2:使用mysql命令行登录修改。

1.连接服务器: mysql -u root -p

2.查看当前所有数据库:show databases; (注意后面结尾有逗号)

3.进入mysql数据库:use mysql;

4.查看mysql数据库中所有的表:show tables;

5.查看user表中的数据:

select Host, User,Password from user;

6.修改user表中的Host。

update user set Host='%' where User='root';

7.刷新:flush privileges;

8.测试连接成功

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。