#查詢數據庫所有用戶 SELECT USER,host FROM mysql.user #新建數據庫用戶 create user 'tianxftest1'@'%' IDENTIFIED by '456123' #賦予用戶角色 revoke all PRIVILEGES on 'pmp_user'.* FROM 'tianxftest1'@'%' IDENTIFIED by '456123' #刪除用戶如下 drop user tianxftest1@192.168.222.110 ; drop user tianxftest1@'%'; #查看用戶權限 show grants for tianxftest1; #授權用戶擁有數據庫的所有權限 grant all privileges on fe.* to fe_group@localhost identified by '123456 #刷新權限表 flush privileges #作用到某個數據庫的具體某張表 grant select, insert, update, delete on testdb.orders to dba@localhost; #作用到某張表的具體列上 grant select(id, se, rank) on testdb.apache_log to dba@localhost; #撤銷某個用戶的某個權限 revoke all on *.* from dba@localhost;