mysql 创建用户相关

mac2022-06-30  70

创建用户:

create user 'username'@'host' identified by 'password';

 设置用户权限:

grant all on database.table to 'username'@'host';

 刷新授权表,此项一定要进行,否则在重启mysqld服务之前,新创建的用户是无法生效的,此时登录会提示Access denied for user

flush privileges;

 如果要使新创建的用户可以远程登录,将创建时的host设为%,或者手动更新user表也可以

update mysql.user set host='%' where user='username';

 

转载于:https://www.cnblogs.com/my-action/p/4498148.html

最新回复(0)