登录Mysql
mysql -u root -p
选择数据库
use mysql
查看plugin设置
select host, user, plugin from user;
可以看到root的plugin是caching_sha2_password,我们希望改成mysql_native_password
alter user 'root'@'localhost' identified with mysql_native_password by '原root用户登录的密码';
alter user 'root'@'%' identified with mysql_native_password by '原root用户登录的密码';
再次查看plugin设置
select host, user, plugin from user;
刷新权限
flush privileges;