解决方法 use mysql; select user,host from user where user='root'; 发现 host 列的值是 ‘%’,因此将修改密码语句改为: - ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'xxxxxx'; flush privileges; 完成。