mysql (grant :授權)(revoke:撤銷授權)

mysql (grant :授權)(revoke:撤銷授權)

4 人贊了文章

  1. 登錄mysql,創建新用戶

    MariaDB [(none)]> insert into mysql.user(Host, User, Password) values(localhost, th_v2, password(th.v2));刷新系統許可權表MariaDB [(none)]> flush privileges;賬號退出,用新用戶登錄

  2. 為用戶授權

    使用root 賬戶登錄新建一個資料庫MariaDB [(none)]> create database th_v2;授權mysql> grant 許可權1,許可權2,…許可權n on 資料庫名稱.表名稱 to 用戶名@用戶地址 identified by 『連介面令』;MariaDB [(none)]> grant all privileges on th_v2.* to th_v2@localhost identified by th_v2;刷新系統許可權表MariaDB [(none)]> flush privileges;

  3. 添加授權grant select on testdb.* to common_user@% grant insert on testdb.* to common_user@% grant update on testdb.* to common_user@% grant delete on testdb.* to common_user@% 查詢用戶授權信息MariaDB [(none)]> show grants for th_v2@localhost;刪除用戶授權信息revoke all on *.* from dba@localhost;

推薦閱讀:

TAG:MySQL | Linux運維 | Linux |