1. 程式人生 > >10 MySQL--權限管理

10 MySQL--權限管理

回收 級別 color localhost reat name 控制 sel class

權限管理
    1、創建賬號
        # 本地賬號
        create user egon1@localhost identified by 123; # mysql -uegon1 -p123
        # 遠程帳號
        create user egon2@192.168.31.10 identified by 123; # mysql -uegon2 -p123 -h 服務端ip
        create user egon3@192.168.31.% identified by 123; #
mysql -uegon3 -p123 -h 服務端ip create user egon3@% identified by 123; # mysql -uegon3 -p123 -h 服務端ip 2、授權
    權限控制力度依次降低 user:
*.* db:db1.* tables_priv:db1.t1 columns_priv:id,name
     # 庫級別 grant all on
*.* to egon1@
localhost; # 授權grant *.* 授權所有級別 grant select on *.* to egon1@localhost; revoke select on *.* from egon1@localhost; # 回收權限revoke
     授權庫  grant select on db1.
* to egon1@localhost; revoke select on db1.* from egon1@localhost
; 授權表 grant select on db1.t2 to egon1@localhost; revoke select on db1.t2 from egon1@localhost; # 回收權限
授權表下的字段 grant select(id,name),update(age) on db1.t2 to
egon1@localhost;

select * from t2 ,,, * 代表所有

10 MySQL--權限管理