首页 > 代码库 > mysql用户和权限

mysql用户和权限

1、创建用户

格式:grant 权限 on 数据库.* to 用户名@登录主机 identified by "密码"

mysql>grant all on *.* to test@"%" identified by "123456";

mysql>flush privileges;

2、修改密码

mysql>update mysql.user set password=password(‘123456‘) where User=‘test‘ and Host=‘localhost‘;

mysql>flush privileges;

3、删除用户

mysql>delete from user where user=‘test1‘ and host=‘localhost‘;

mysql>flush privileges;

mysql用户和权限