用go链接本地mysql时,报了此错误
panic: shop db open failed: this authentication plugin is not supported
经查,是因为mysql的版本是8.0.33,8以上的版本用户密码默认加密方式为“caching_sha2_password”,由于项目的各种包版本较早,可能不支持此种方式,当前解决方法是修改mysql增加对老版本加密方式“mysql_native_password”的支持。
找到my.cnf配置文件,增加以下配置:
default-authentication-plugin=mysql_native_password
之后保存退出。
再重启mysql使其生效即可。