版本:mysql --version
mysql Ver 8.0.25-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))
1.直接用root权限进入mysql命令行
sudo mysql
2.修改密码
alter user 'root'@'localhost' identified with mysql_native_password by '密码';
3.开发远程连接
user mysql;
update user set host='%' where user='root';
4.刷新
flush privileges;