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;