surroundings

 OS: Ubuntu 20.04
MySQL: 8.0.30

step

 mysql -u root
mysql> use mysql;
# 查看账号信息
mysql> select user, host, authentication_string from user;
# 设置任意 ip 可使用 root 连接
mysql> update user set host='%' where user='root';
# 设置密码为 xxxx
grant all privileges on *.* to 'root'@'%' identified by 'xxxx' with grant option;
This article is from qbit snap

qbit
268 声望279 粉丝