資料庫使用者許可權管理與測試

2021-08-07 10:37:41 字數 1552 閱讀 8337

課程編寫

類別

內容

實驗課題名稱

資料庫使用者許可權管理與測試

實驗目的與要求

掌握資料庫中的許可權管理思想,並會建立使用者許可權管理中的各種物件。

實驗環境

vpc1(虛擬pc)

windows xp 系統

vpc1 連線要求

與實驗網路直連

軟體描述

資料庫管理系統(dbms) :mysql 5.5

實驗環境描述

1、學生機與實驗室網路直連;

2、vpc1與實驗室網路直連;

3、學生機與vpc1物理鏈路連通;

預備知識

實驗內容

建立使用者許可權管理中的使用者和使用者許可權,並測試。

實驗步驟

開啟實驗平台,進入windows xp系統。

(1)開啟命令列提示符,從localhost,用root使用者名稱登陸mysql5.5,輸入密碼:123456。

(2)建立資料庫student_course,並在該資料庫中建立student表:

建立資料庫student_course:

建立表students:

在表中插入兩條記錄:

列印表中的內容:

(3)建立資料庫dbrole,刪除dbrole。

建立資料庫dbrole:

檢視所有存在的資料庫:

刪除資料庫dbrole:

檢視資料庫是否被刪除:

(4)建立資料庫使用者user1,並賦予user1以select 表students的許可權。

建立使用者user1,登陸位置是『localhost』,密碼是『password』:

檢視系統中所有使用者,發現user1已被建立:

賦予user1以select 表students的許可權:

退出root:

登陸user1:

user1使用select檢視表中的內容:

(5)將建立表create的許可權授予使用者 user1,並允許他傳播該許可權。

在user1下 嘗試建表,失敗:

退出user1,進入root:

將建立表create的許可權授予使用者 user1,並允許他傳播該許可權:

檢視user1的許可權,發現現在已經有建表create的許可權:

退出root, 進入user1:

使用user1嘗試建表,會發現建表成功:

(6)收回 user1 建立表的許可權。

進入root賬戶:

收回 user1 建立表的許可權:

檢視並測試user1建表的許可權是否被收回:

user1使用者嘗試建表,結果失敗:

證明user1的建表許可權已經被收回。

mysql測試許可權 資料庫使用者許可權管理與測試

開啟實驗平台,進入windows xp系統。1 開啟命令列提示符,從localhost,用root使用者名稱登陸mysql5.5,輸入密碼 123456。2 建立資料庫student course,並在該資料庫中建立student表 建立資料庫student course 建立表students 在...

mysql資料庫使用者許可權管理

知識點總結 三句話 1.create user golden localhost identified by gd2017 2.grant all on test.to golden localhost 3.flush privileges 解釋 1 create user 語句用於建立使用者 及密...

ORACLE資料庫管理 pdb使用者 許可權管理

1 common users普通使用者 使用者名稱以c 或c 開頭 僅建立在cdb層 建立在pdb層會報錯ora 65094 invalid local user or role name create user c test identified by test container all gra...