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