是为了解决VSCode
的SQLTools
插件连接数据库的这个报错。(先排除密码错误)
Request connection/GetChildrenForTreeItemRequest failed with message: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
该问题是由于SQLTools
插件的MySQL
驱动不支持MySQL8
的caching_sha2_password
默认加密方式。如果你要继续用这个插件,可以将数据库的用户加密改为mysql_native_password
方式。
添加mysql_native_password
加密方式的admin用户
这里给了admin相当于root的权限。
create user 'admin'@'%' identified with mysql_native_password by 'your_password';
grant all privileges on *.* to 'admin'@'%' with grant option;
flush privileges;
如果已有用户,可以参照这条修改密码加密方式
alter user 'admin'@'%' identified with mysql_native_password by 'your_password';
删除admin用户
drop urer admin;
网友评论