1、Insert语句创建用户: //需刷新权限才生效
insert into user (host,user,password,ssl_cipher,x509_issuer,x509_subject) values
(“主机号”,”用户名”,password(”密码”),””,””,””);
2、Update语句修改用户密码: //需刷新权限才生效
Update user set password=password(“密码”)
Where host=”主机号” and user=”用户名”;
3、Delete语句删除用户 //需刷新权限才生效
Delete from user where host=”主机号” and user=”用户名”;
4、刷新权限:
flush privileges;
5、create语句创建用户: //无需刷新权限,直接生效
create user “用户名”@”主机号” identified by “密码”;
6、set语句修改密码: //无需刷新权限,直接生效
Set password = password(“密码”);
Set password for “用户名”@”主机号” = password(“密码”);
106、drop语句删除用户: //无需刷新权限,直接生效
drop user “用户名”@”主机号”;
7、查看用户权限:
Show grants for “用户名”@”主机号”\G;
8、grant语句创建用户权限:
grant 权限 on 库名.表名 to “用户名”@”主机号” identified by “密码”;
9、grant语句给用户授权
grant 权限on 库名.表名 to “用户名”@”主机号”;
10、revoke语句回收用户部分权限:
revoke 权限 on 库名.表名 from “用户名”@”主机号”;
11、回收用户所有权限:
revoke all privileges,grant option from “用户名”@”主机号”;