ywtssydm

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\'@\'%\';

分类:

技术点:

相关文章: