mysql配置白名单访问

mysql配置白名单访问

1.登录

mysql -uroot -pmysql

2.切换至mysql库

use mysql;

3.查看有白名单权限的用户

select Host,User from user;

4.指定ip有权限访问mysql

GRANT ALL ON *.* to root@'192.168.1.4' IDENTIFIED BY 'your-root-password';

如果没有密码则不用填,

GRANT ALL ON *.* to root@'192.168.1.4' ;

@后面的是指定白名单的ip

5.删除白名单用户的权限

DELETE FROM user WHERE User='username' and Host='host';

6.刷新

修改权限之后都要刷新才会生效

FLUSH PRIVILEGES;

(0)

相关推荐