- 查看數(shù)據(jù)庫的用戶表
select * from mysql.user\G;```
2. 創(chuàng)建一個用戶同時設(shè)置密碼
create user '用戶名'@'登錄地址' identified by '密碼';```
- 創(chuàng)建一個用戶同時沒有設(shè)置密碼
create user 'linlin'@'localhost';```
4. 授權(quán)給用戶 grant all(所有的權(quán)限) on 數(shù)據(jù)庫(* 表示所有).數(shù)據(jù)表(* 表示所有) to '用戶名'@'登錄的地址'
grant all on lamp151.* to 'huxiaoshuai'@'localhost';```
- 移除權(quán)限 --- 同時移除insert,update的權(quán)限
revoke insert,update on lamp151.* from 'pengpeng'@'192.168.151.42';```
6. 刪除用戶
delete from mysql.user where user = 'huxiaoshuai';```
- 刷新權(quán)限
flush privileges```