mysql新建使用者,修改許可權

2021-09-27 12:36:39 字數 847 閱讀 3341

檢視使用者:

select * from mysql.user
新增使用者:

create user 'li1'@'localhost' identified by 'li123456!';
刪除使用者:

drop user 'li1'@'localhost';
修改使用者名稱:

rename user 'li1'@'localhost' to 'li2'@'localhost';
修改密碼:

set password for 'li1'@'localhost' = password('li123456!!');
許可權:

# 新增所有許可權

grant all privileges on `test`.* to 'li1'@'localhost';

# 查詢許可權

grant select on `test`.* to 'li1'@'localhost';

# 查詢,插入,更新許可權

grant select,insert,update on `test`.* to 'li1'@'localhost';

# 刪除許可權

revoke insert,update on test.* from 'li1'@'localhost';

# 重新整理許可權

flush privileges;

# 檢視某使用者許可權

show grants for 'li1'@'localhost';

mysql修改許可權 MySql 修改許可權

mysql 賦予使用者許可權命令的簡單格式可概括為 grant 許可權 on 資料庫物件 to 使用者 一 grant 普通資料使用者,查詢 插入 更新 刪除 資料庫中所有表資料的權利。grant select on testdb.to common user grant insert on tes...

mysql 修改許可權 修改mysql許可權

關於mysql的使用者管理,筆記 1 建立新使用者 通過root使用者登入之後建立 grant all privileges on to testuser localhost identified by 123456 建立新使用者,使用者名為testuser,密碼為123456 grant all ...

mysql修改許可權

mysql許可權 顯示使用者許可權 mysql show grants for jeffrey localhost 通常,資料庫管理員首先建立使用者,定義其非特權特徵,例如其密碼,是否使用安全連線以及對伺服器資源的訪問限制,然後使用grant來定義其許可權。alter user可用於更改現有賬戶的非...