mysql8.0.20创建用户和权限赋予

# 1.先进入mysql数据库
use mysql;
# 2.在user表中创建账号
create user 'root'@'%' identified by 'root.123';
# 3.给创建好的账号赋予远程权限
grant all privileges on *.* to 'root'@'10.150.32.100' with grant option;
# 4.允许所有 ip 远程访问(危险!)
grant all privileges on *.* to 'root'@'%' with grant option;
# 5.刷新数据库
FLUSH PRIVILEGES;
# 6.查看数据库中的用户权限表
select User,authentication_string,Host from user;   # 如下图

猜你喜欢

转载自blog.csdn.net/shileimohan/article/details/128038490