日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

2.3.3 mysql 权限系统介绍

發布時間:2024/9/3 数据库 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 2.3.3 mysql 权限系统介绍 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

授權案例總結

host 列: %,localhost,127.0.0.1,::11)授權普通用戶,具有查詢、插入、更新、刪除 itpux 這個數據庫所有表數據的權限。 grant select, insert, update, delete on itpux.* to itpux1@'%';flush privileges; show grants for itpux1@'%'2)開發人員授權:創建/刪除/修改-表/索引/視圖/存儲過程/函數等權限 create user dev@'%' identified by 'dev'; grant create,alter,drop on itpux1.* to dev@'%'; flush privileges; show grants for dev@'%';create user dev@'10.0.0.%' identified by 'dev'; grant create,alter,drop on itpux1.* to dev@'10.0.0.%'; flush privileges; show grant for dev@'10.0.0.%';3)操作mysql外鍵的權限 grant references on itpux1.* to dev@'%'; flush privileges;4)操作mysql臨時表的權限 grant create temporary tables on itpux1.* to dev@'%'; flush privileges; 5)操作mysql索引的權限 grant index on itpux1.* to dev@'%'; flush privileges;6)操作mysql視圖的權限 grant create view,show view on itpux1.* to dev@'%'; flush privileges; 7)操作mysql存儲過程/函數的權限 grant create routine,alter routine,execute on itpux1.* to dev@'%';8)授權一個普通的dba用戶,可以管理某一個數據庫 grant all privileges on itpux to itpuxdba@'localhost' identified by 'itpuxdba'; flush privileges;9)授權一個高級的dba用戶,可以管理所有的數據庫 grant all privileges on *.* to alldba@'localhost' identified by 'alldba'; flush privileges;10)授權針對所有的數據庫 grant all privileges on *.* to alldba@'localhost'; flush privileges;11)授權針對單個的數據庫 grant all privileges on itpux to alldbae'LocaLhost'i grant select on itpux.* to alldba@'localhost'; flush privileges;12)授權針對所有的數據庫 grant select on itpux.* to alldba@'locaLhost'; flush privileges;13)授權針對單個列 grant select(deptno,dname) on itpux.dept to alldba@'localhost'; flush privileges;14)授權針對存儲過程和函數 grant execute on procedure 庫名.過程名 to alldba@'localhost'; grant execute on function 庫名.函數名 to alldba@'localhost'; flush privileges;

revoke 語法

1)授權針對所有的數據庫 revoke revoke all privileges on *.* from alldba@'localhost'; flush privileges;2)授權針對單個的數據庫 revoke all privileges on itpux.* from alldba@'locaLhost'; revoke select on itpux.* from alldba@'localhost'; flush privileges;3)授權針對所有的數據庫 revoke select on itpux.* from alldba@'locaLhost'; flush privileges;4)授權針對單個列 revoke select(deptno,dname) on itpux.dept from alldba@'localhost'; flush privileges;5)授權針對存儲過程和函數 revoke execute on procedure 庫名.過程名 from alldba@'localhost'; revoke execute on function 庫名.函數名 from alldba@'localhost'; flush privileges;show grants for alldba@'localhost' show grants for itpux1@'localhost' 另類方法:直接修改授權表回收授權-不建議使用 select user,host from mysql.user delete from mysql.user where user='alldba' and host='localhost'; commit; flush privileges; select user,host from mysql.user;

刪除用戶及重命名用戶

select user,host from mysql.user; drop user dev; drop user dev@'%'; drop user dev@'192.168.1.%'; select user,host from mysql.user where user like 'dev%'; select user,host from mysql.user; rename user 'itpuxdba'@'localhost' to 'itpuxdba1'@'localhost';

顯示授權

show grants for itpux; show grants for itpux@localhost; select * from mysql.user where user='itpux1' and host='localhost';select CURRENT_USER();show grants; show grants for current_user;mysql root@localhost:mysql> show grants for current_user\G ***************************[ 1. row ]*************************** Grants for root@localhost | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES,
SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER,
CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `root`@`localhost` WITH GRANT OPTION ***************************[ 2. row ]*************************** Grants for root@localhost | GRANT APPLICATION_PASSWORD_ADMIN,AUDIT_ADMIN,BACKUP_ADMIN,BINLOG_ADMIN,BINLOG_ENCRYPTION_ADMIN,CLONE_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,
GROUP_REPLICATION_ADMIN,INNODB_REDO_LOG_ARCHIVE,INNODB_REDO_LOG_ENABLE,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_APPLIER,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,
SERVICE_CONNECTION_ADMIN,SESSION_VARIABLES_ADMIN,SET_USER_ID,SHOW_ROUTINE,SYSTEM_USER,SYSTEM_VARIABLES_ADMIN,TABLE_ENCRYPTION_ADMIN,XA_RECOVER_ADMIN ON *.* TO `root`@`localhost` WITH GRANT OPTION ***************************[ 3. row ]*************************** Grants for root@localhost | GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION

總結

以上是生活随笔為你收集整理的2.3.3 mysql 权限系统介绍的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。