命令记不住

登陆

Mysql 5.7 和 8.0 版本用户更新

Mysql 5.7和8.0版本用户更新

1.mysql8.0

mysql8.0

# 修改默认用户
use mysql; 
update user set authentication_string='' where user='root';
flush privileges;
use mysql; 
ALTER user 'root'@'localhost' IDENTIFIED BY '123123';
flush privileges;

# 添加新用户
create user 'admin'@'%' identified by '123123';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
flush privileges;

done

2.mysql5.7

mysql5.7

# 修改默认用户
use mysql; 
update user set authentication_string=password("123123") where user="root";
flush privileges;

#添加新用户
grant all privileges on *.* to 'admin'@'%' identified by '123123' with grant option;
flush privileges;

create user 'opsxdevcom'@'%' identified by '123123';
GRANT ALL PRIVILEGES ON pipe.* TO 'opsxdevcom'@'%';
flush privileges;

done

推荐阅读