Mysql配置白名單

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;

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章