mysql添加訪問權限

1、mysql 添加用戶訪問權限 

grant all on *.* to 'root'@'192.168.0.%' identified by 'root';

grant all on db1.b1 to '用戶'@'%' identified by '密碼';

授權root用戶可以在任何 % ip下對db1數據庫的b1表進行訪問

2、添加增、刪、改、查權限,授權本機操作權限

grant select ,insert ,update,delete on *.* to 'root'@'192.168.0.%' identified by 'root';

grant select,insert,update,delete,create,drop,alter on 數據庫.* to 用戶@'127.0.0.1' identified by '密碼';

3、數據庫主從備份,添加從庫複製權限

grant replication slave on *.* to 'slave'@'192.168.1.%' identified by '123456';

4、添加操作權限,允許該數據庫開啓遠程訪問的權限

grant all privileges on 數據庫.* to 用戶@localhost identified by "密碼" ;

grant all privileges on *.* to 'root'@'%' identified by '123456'  
這裏的123456爲你給新增權限用戶設置的密碼,root用戶 在 %代表所ip條件下 可以操作數據庫

5、授權完記得刷新

 FLUSH PRIVILEGES;

 

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