mysql用户权限配置、添加、修改

查询mysql 有多少用户

select host, user from user;

select user from mysql.user;

创建用户

CREATE USER ‘username’@‘host’ IDENTIFIED BY ‘password’;

查看用户权限

show grants for my@localhost;

指定部分权限

grant insert,update,delete,select on *.* to mytest@localhost;

指定某个库全部权限

grant all on databasesname.* to mytest@localhost;

刷新权限

flush privileges;

设置用户密码

SET PASSWORD FOR ‘username’@‘host’ = PASSWORD(‘newpassword’);

设置当前用户

SET PASSWORD = PASSWORD(“newpassword”);

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注