日期:2014-05-16  浏览次数:20749 次

解决客户端连接mysql出现 xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server

今天在centos上把mysql都配置好了,在linux下登录mysql都没有问题,但是在windows下用navicat远程连接连接msyql时报?is not allowed to connect to this MySQL server ,上网一查,发现是没有远程连接的权限

?

于是我采用新增加一个用户的方法,并赋予任意ip都可以远程连接的权限,

mysql新增用户

?

#mysql -uroot -proot

mysql> grant all privileges on *.* to 'test'@'%' identified by 'test' with grant option;

mysql>?flush privileges;

?

此处'%'很重要,代表任意ip都可以远程连接,而默认的root用户只能“localhost” 所以才会报 “?is not allowed to connect to this MySQL server” 无法连接数据库!

?

然后在远程连接一下,发现能连接了!

问题解决! mark 一下 ? ^_^