1.登录mysql并进入命令行操作
mysql -u root -p
2.如果赋予该ip下该用户所有权限
grant all on *.* to 'username'@'ip' identified by 'password' with grant option;
例如:
grant all on *.* to 'root'@'192.168.1.111' identified by '123@zxcv' with grant option;
如果是赋予部分权限,可以如下:
grant select,create,drop,update,alter on *.* to 'username'@'ip' identified by 'password' with grant option;
3.删除白名单用户的权限
DELETE FROM user WHERE User='username' and Host='ip';
这步慎做,删错了就登不上mysql了
4.刷新权限
FLUSH PRIVILEGES;