MySQL8登录报错

···
ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
···
原因
MySQL 8.0 默认使用 caching_sha2_password 插件,而不是旧版的 mysql_native_password

Solution

# 修改现有user
ALTER USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
FLUSH PRIVILEGES;

# 新增user

CREATE USER 'test'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
GRANT ALL PRIVILEGES ON *.* TO 'test'@'%';
FLUSH PRIVILEGES;
posted @ 2025-04-25 17:07  骑白马走三关  阅读(16)  评论(0)    收藏  举报