mysql 添加用戶並給用戶賦予不同的權限


mysql添加用戶,並給用戶設置權限:

1.本地訪問用戶:
create user 'front'@'localhost' identified by '123456';

2.允許外網 IP 訪問
create user 'front'@'%' identified by '123456';

3.授予用戶通過外網IP對於該數據庫的全部權限
grant all privileges on `testdb`.* to 'front'@'%' identified by '123456';

4.授予用戶在本地服務器對該數據庫的全部權限
grant all privileges on `testdb`.* to 'front'@'localhost' identified by '123456';

5.授予該用戶通過外網IP對該服務器上所有數據庫的全部權限
grant all privileges on *.* to 'front'@'%' identified by '123456';

6.授予用戶在本地服務器對該服務器上所有數據庫的全部權限
grant all privileges on *.* to 'front'@'localhost' identified by '123456';

7.刷新權限
flush privileges;

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM