mysql創建數據庫用戶及分配權限


#查詢數據庫所有用戶
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; 

 


免責聲明!

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



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