標籤:from 服務端 p12 rev upd 客戶 ble root 命令
許可權管理(root)
1、建立帳號
# 本地帳號
create user‘egon1‘@‘localhost‘ identified by ‘123‘; # mysql -uegon1 -p123
# 遠程帳號,用戶端ip(192.168.31.10)
create user‘egon1‘@‘192.168.31.10‘ identified by ‘123‘; # mysql -uegon1 -p123 -h 服務端ip
create user‘egon1‘@‘192.168.31.%‘ identified by ‘123‘; # mysql -uegon1 -p123 -h 服務端ip
create user‘egon1‘@‘%‘ identified by ‘123‘; # mysql -uegon1 -p123 -h 服務端ip
3、授權
user: *.* ## 所有表所有許可權
db: db1.* ## db1庫下所有許可權
tables_priv: db1.t1 ## 表t1
columns_priv: id,name ## 表中欄位
放權
grant all on *.* to ‘egon1‘@‘localhost‘;
grant select on *.* to ‘egon1‘@‘localhost‘;
回收許可權
revoke select on *.* from ‘egon1‘@‘localhost‘;
select * from mysql.user\G ## cmd命令查看
對庫
grant select on db1.* to ‘egon1‘@‘localhost‘;
revoke select on db1.* from ‘egon1‘@‘localhost‘;
對錶
grant select on db1.t1 to ‘egon1‘@‘localhost‘;
revoke select on db1.t1 from ‘egon1‘@‘localhost‘;
對欄位
grant select(id,name),update(age) on db1.t1 to ‘egon1‘@‘localhost‘;
revoke select(id,name),update(age) on db1.t1 from ‘egon1‘@‘localhost‘;
mysql許可權管理