如果出现 【SET PASSWORD has no significance for user ‘root’@‘localhost’ as the authentication method used
doesn’t
store
authentication data in the MySQL server。。。。。】错误
进入mysql:mysql -u root -p
使用命令设置密码:ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password by ‘mynewpassword’;
重新使用 sudo mysql_secure_installation 配置向导
修改密码
# 检查用户使用授权方式SELECTuser, authentication_string, plugin, host
FROM mysql.user;select host,userfrom mysql.user;
mysql -u root -p # 直接回车登录
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password by ‘你的密码’;
exit
mysql -u root -p # 输入修改的密码登录
use mysql
update user set host = ‘%’ where user = ‘root’; # 修改host
flush privileges; # 刷新权限
grant all privileges on . to root@‘%’ with grant option; # 允许远程登录