mysql用户管理与权限
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 '用户名'@'%':