由于从 MySQL8 开始,身份验证插件发生了改变,默认的 “caching_sha2_password” 不允许远程登录,故需将此插件修改为 “mysql_native_password” 便可登录。
方法:
vim /data/mysql/mysql_3306/my_3306.cnf
# 在[mysqld]中添加如下的代码default_authentication_plugin=mysql_native_password
这个需要重启服务才生效,然后就可以正常连接,并不是你配置环境变量导致的。
可参考https://mp.weixin.qq.com/s/011y6eCny_p96SLAGRxTEg文中第九节内容。
密码不对。