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;
 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM