我是出现如上错误
可以通过下面方法检查一下。
- 检测mysql服务是否运行:
service mysql status
- 进入mysql,查看端口号是不是有问题。
show global variables like 'port';
- 如果上面都没有问题,可以试试下面的
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'your password';# %可以换成localhost,看你的host是什么了
FLUSH PRIVILEGES;
mysql_native_password是旧的密码验证机制
我是这种解决的