Mysql 创建用户并授权方法

一、创建用户

root 用户登陆,切换到mysql 数据库:

create user 'test'@"%" identified by 'test123';
create user 'test'@‘localhost' identified by 'test123';
create user 'qa'@'localhost' identified by 'qa123456';

二、授予权限

grant all privileges on *.* to test@‘%’;
grant all privileges on *.* to test@‘localhost’;
grant all privileges on *.* to qa@'localhost';

三、刷新权限

flush privileges; 

四、修改用户密码

切换到mysql 数据库: use mysql;

update user set password=password("cx_qa123456") where user="cx_test";
flush privileges;
 
posted @ 2022-02-18 09:50  keena_jiao  阅读(1471)  评论(0编辑  收藏  举报