重慶分公司,新征程啟航
為企業提供網站建設、域名注冊、服務器等服務
為企業提供網站建設、域名注冊、服務器等服務
小編給大家分享一下MySQL給用戶分配權限的方法,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!
站在用戶的角度思考問題,與客戶深入溝通,找到寶興網站設計與寶興網站推廣的解決方案,憑借多年的經驗,讓設計與互聯網技術結合,創造個性化、用戶體驗好的作品,建站類型包括:網站設計制作、成都網站設計、企業官網、英文網站、手機端網站、網站推廣、域名注冊、網絡空間、企業郵箱。業務覆蓋寶興地區。
MySQL 賦予用戶權限命令的簡單格式可概括為:
grant 權限 on 數據庫對象 to 用戶
mysql給用戶分配權限示例:
一、grant 普通數據用戶,查詢、插入、更新、刪除 數據庫中所有表數據的權利。
grant select on testdb.* to common_user@'%' grant insert on testdb.* to common_user@'%' grant update on testdb.* to common_user@'%' grant delete on testdb.* to common_user@'%'
或者,用一條 MySQL 命令來替代:
grant select, insert, update, delete on testdb.* to common_user@'%'
二、grant 數據庫開發人員,創建表、索引、視圖、存儲過程、函數。。。等權限。
grant 創建、修改、刪除 MySQL 數據表結構權限。
grant create on testdb.* to developer@'192.168.0.%'; grant alter on testdb.* to developer@'192.168.0.%'; grant drop on testdb.* to developer@'192.168.0.%';
grant 操作 MySQL 外鍵權限。
grant references on testdb.* to developer@'192.168.0.%';
grant 操作 MySQL 臨時表權限。
grant create temporary tables on testdb.* to developer@'192.168.0.%';
grant 操作 MySQL 索引權限。
grant index on testdb.* to developer@'192.168.0.%';
grant 操作 MySQL 視圖、查看視圖源代碼 權限。
grant create view on testdb.* to developer@'192.168.0.%'; grant show view on testdb.* to developer@'192.168.0.%';
grant 操作 MySQL 存儲過程、函數 權限。
grant create routine on testdb.* to developer@'192.168.0.%'; -- now, can show procedure status grant alter routine on testdb.* to developer@'192.168.0.%'; -- now, you can drop a procedure grant execute on testdb.* to developer@'192.168.0.%';
看完了這篇文章,相信你對mysql給用戶分配權限的方法有了一定的了解,想了解更多相關知識,歡迎關注創新互聯行業資訊頻道,感謝各位的閱讀!