mysql用户管理与权限

2018-06-18 00:49:23来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

1、设置密码

set password for 用户名@localhost = password('密码');

2、取消密码

set password for 用户名@localhost = password('');

3、创建账号

create user admin identified by '123';

create user 'admin'@'%' identified by '123';

4、删除账号

delete from mysql.user where user=用户名;

drop user 用户名;

5、授权并建立账号

grant all privileges on *.* to 用户名@localhost;--创建一个只能本地登录的空密码用户

grant all privileges on *.* to '用户名'@localhost identified by 密码;--创建一个只能本地登录的用户

grant all privileges on *.* to '用户名'@'%': --创建一个可以远程登录的用户

6、收回权限

revoke all privileges on *.* from '用户名'@'%':

 

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:mysql存储过程

下一篇:mysql索引的注意事项