Host 'XXX' is not allowed to connect to this MySQL server 解决方法/开启Root MySQL远程帐号

1. 登录mysql:

mysql -uroot -p123456

    或通过图形化客户端登录;

2. 对root账户进行授权:

 grant all PRIVILEGES on test_db.* to root@'192.168.21.101'  identified by '123456';

 如果是对所有的ip都可访问,将具体ip换成%即可;

grant all PRIVILEGES on test_db.* to root@'%'  identified by '123456';

 123456为root密码。

3. 最后一步,最重要的一步,一定要执行下面语句,否则不会立刻生效的

flush privileges;

猜你喜欢

转载自halfsking.iteye.com/blog/2348418