-- 給予dba用戶所有權限
grant all privileges on *.* to 'dba'@'%' identified by '123456' with grant option;
-- 給予普通dba管理某個 mysql 數據庫的權限
grant all privileges on db.* to 'dba'@'%' identified by 'qwerty123456';
-- 普通用戶,查詢數據庫中所有表數據的權利
grant select on db.* to 'sel_user'@'%' identified by '123456';
-- 開發人員,查詢、插入、更新、刪除 數據庫中所有表數據
-- 創建表、索引、視圖、存儲過程、函數。。。等權限
grant select, insert, update, delete on db.* to 'alt_user'@'%' identified by '123456';
-- 創建、修改、刪除 mysql 數據表結構權限
grant create,alter,drop on db.* to 'alt_user'@'%';
-- 操作 mysql 外鍵權限
grant references on db.* to 'alt_user'@'%';
-- grant 操作 mysql 臨時表權限
grant create temporary tables on db.* to 'alt_user'@'%';
-- grant 操作 mysql 索引權限
grant index on db.* to 'alt_user'@'%';
-- grant 操作 mysql 視圖、查看視圖源代碼 權限
grant create view on db.* to 'alt_user'@'%';
grant show view on db.* to 'alt_user'@'%';
-- grant 操作 mysql 存儲過程、函數 權限
grant create routine on db.* to 'alt_user'@'%';
grant alter routine on db.* to 'alt_user'@'%';
grant execute on db.* to 'alt_user'@'%';
-- 所有執行完刷新權限
flush privileges;