错误描述:is not allowed to connect to this MySQL server
今天使用mysql可视化工具连接其他服务器上的mysql时报了这个错is not allowed to connect to this MySQL server
,但是本地连接是正常的,一般都是因为用于连接mysql的用户没有开启连接权限。
原因:Mysql配置了不支持远程连接引起,用于连接mysql的用户名开了ip限制
解决方法:
1.首先在mysql服务器上登录mysql,
mysql -u root -pxxxxx
2.切换mysql数据库
use mysql;
3.查看当前已存在用户的连接权限
select host from user where user='root';
一般情况,此时查出来的结果,都是只支持127.0.0.1
连接
4.根据需求,可设置某个用户用于指定ip地址连接,如
update user set host='192.168.10.162' where user='root';
或者直接允许所有用户连接此服务:
update user set host='%' where user='root';
5.最后保存本次修改结果,刷新mysql的系统权限相关的数据表
flush privileges;
设置完毕之后,再次使用mysql管理工具,连接数据库,发现可以正常连接