MySQL使用者授權

2021-09-13 10:44:04 字數 1289 閱讀 8731

mysql使用者授權

1、建立資料庫sea

create database sea;
2、授權給sea這個使用者對資料庫(sea)所有的許可權(剛開始沒有這個使用者,會自動建立,使用者名稱:sea,密碼:sea123.);

grant all on sea.* to 'sea'@'localhost' identified by 'sea123.';
3、測試使用者(1.)登陸mysql

(2.)進入資料庫,建立乙個表名為users的表;

(表中有兩列:姓名 **)

use sea;

create table users(姓名 varchar(20),** char(10));

(3.)插入資料:楊過 110,張三丰 119;

insert into users values ('楊過',110);

insert into users values ('張三丰',119);

(4.)查詢表中所有內容

4.撤銷使用者sea對sea表的許可權;並重新給他賦予查詢的許可權

5.驗證

mysql> update users set 姓名='張無忌' where 姓名='楊過';

error 1142 (42000): update command denied to user 'sea'@'localhost' for table 'users'

mysql 授權 mysql 使用者授權

mysql grant 許可權1,許可權2,許可權n on 資料庫名稱.表名稱 to 使用者名稱 使用者位址 identified by 連線口令 許可權1,許可權2,許可權n代表select,insert,update,delete,create,drop,index,alter,grant,re...

mysql授權使用者許可權 mysql授權使用者許可權

grant 普通資料使用者,查詢 插入 更新 刪除 資料庫中所有表資料的權利。grant select on testdb.to common user grant insert on testdb.to common user grant update on testdb.to common us...

mysql授權 MySQL使用者授權(GRANT)

當成功建立使用者賬戶後,還不能執行任何操作,需要為該使用者分配適當的訪問許可權。可以使用 show grant for 語句來查詢使用者的許可權。注意 新建立的使用者只有登入 mysql 伺服器的許可權,沒有任何其他許可權,不能進行其他操作。usage on 表示該使用者對任何資料庫和任何表都沒有許...