1.進入到mysql資料庫下
mysql>use mysql;
2.創建新用戶
指定ip為192.168.1.1的operationCenterAdmin用戶登錄
create user ‘operationCenterAdmin’@‘192.168.1.1’ identified by '123456';
指定ip為192.168.1.開頭的operationCenterAdmin用戶登錄
create user 'operationCenterAdmin'@'192.118.1.%' identified by '123456';
指定任何ip的operationCenterAdmin用戶登錄
create use 'operationCenterAdmin'@'%' identified by '123456';
3.授權
grant select on 資料庫名.表名 to "operationCenterAdmin’"@'%';
eg:grant select on mis.* to "operationCenterAdmin’"@'%';
4.更新權限
flush privileges;
技能補充:
1.洗掉用戶
drop user '用戶名'@'IP地址';
2.修改用戶
rename user '用戶名'@'IP地址' to '新用戶名'@'IP地址';
3.修改密碼
set password for '用戶名'@'IP地址'=Password('新密碼');
4.查看用戶權限
show grants for '用戶'@'IP地址'
5.授權
grant select ,insert,update on db1.t1 to "用戶名"@'%';
5.1授予所有權限,除了grant這個命令,這個命令是root才有的
grant all privileges on db1.t1 to "用戶名"@'%';
6.取消權限
取消來自遠程服務器的operationCenterAdmin用戶對資料庫db1的所有表的所有權限
revoke all on db1.* from 'operationCenterAdmin'@"%";
取消來自遠程服務器的operationCenterAdmin用戶所有資料庫的所有的表的權限
revoke all privileges on '*' from 'operationCenterAdmin'@'%';
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/233495.html
標籤:其他
下一篇:SQL on Linux: Erro Unable to read instance id from /var/opt/mssql/.system/instance_id
