實驗四 數據庫安全設計


實驗四 數據庫安全設計

數據庫維護人員(1人):可對訂單數據庫進行任何操作。
賬號名稱:system_dbowner,密碼為usercode1,允許任何ip通過此用戶連接數據庫

all為所有權限

訂單數據庫.*表示訂單數據中的所有表

system_dbowner 為用戶名

%表示所有ip地址

usercode1為密碼

這句grant命令執行后如果數據庫中沒有對應的角色會自動創建

grant all on 訂單數據庫.* to 'system_dbowner'@'%' identified by 'usercode1';
數據錄入人員(2人):可對訂單數據庫中所有表進行插入、刪除、更新操作,
(注意:為了順利進行刪除更新操作,也需要能有查詢權限)
不能創建與修改表結構及其它授權等操作。
賬號名稱:datarecorder1, datarecorder2,密碼為usercode1,允許任何ip通過此用戶連接數據庫
grant select,insert,update,delete on 訂單數據庫.* to 'datarecorder1'@'%' identified by 'usercode1';
grant select,insert,update,delete on 訂單數據庫.* to 'datarecorder2'@'%' identified by 'usercode1';
訂單管理人員(2人):能對訂單數據庫中的訂單表和訂貨項目表進行插入、刪除、更新操作,
其它表僅能查詢(注意:為了順利進行刪除更新操作,訂單表和訂貨項目表也需要能有查詢權限)。
不能創建與修改表結構及其它授權等操作。
賬號名稱:order_1,order_2,密碼為usercode1,允許任何ip通過此用戶連接數據庫
--授予訂單數據庫所有表的查詢權限
grant select on 訂單數據庫.* to 'order_1'@'%' identified by 'usercode1';
grant select on 訂單數據庫.* to 'order_2'@'%' identified by 'usercode1';
-- 授予訂單數據庫訂單表和訂貨項目表的增刪改權限
grant insert,update,delete on 訂單數據庫.訂單 to 'order_1'@'%' identified by 'usercode1';
grant insert,update,delete on 訂單數據庫.訂單 to 'order_2'@'%' identified by 'usercode1';
grant insert,update,delete on 訂單數據庫.訂貨項目 to 'order_1'@'%' identified by 'usercode1';
grant insert,update,delete on 訂單數據庫.訂貨項目 to 'order_2'@'%' identified by 'usercode1';
客戶管理人員(2人):能對訂單數據庫中的代理商表和客戶表進行插入、刪除、更新,
其它表僅能查詢(注意:為了順利進行刪除更新操作,代理商表和客戶表也需要能有查詢權限)。
不能創建與修改表結構及其它授權等操作。
賬號名稱:customer_1, customer_2,密碼為usercode1,允許任何ip通過此用戶連接數據庫
-- 賦予登陸權限
grant usage on *.* to 'customer_2'@'%' identified by 'usercode1';
grant usage on *.* to 'customer_1'@'%' identified by 'usercode1';
-- 賦予對訂單數據庫查詢權限
grant select on 訂單數據庫.* to 'customer_2'@'%' identified by 'usercode1';
grant select on 訂單數據庫.* to 'customer_1'@'%' identified by 'usercode1';
-- 賦予對代理商和客戶表的增刪改權限
grant insert,update,delete on 訂單數據庫.客戶 to 'customer_2'@'%' identified by 'usercode1';
grant insert,update,delete on 訂單數據庫.客戶 to 'customer_1'@'%' identified by 'usercode1';
grant insert,update,delete on 訂單數據庫.代理商 to 'customer_2'@'%' identified by 'usercode1';
grant insert,update,delete on 訂單數據庫.代理商 to 'customer_1'@'%' identified by 'usercode1';


免責聲明!

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



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