连接MySql报错Unable to load authentication plugin 'caching_sha2_password'

在使用mybatis-generator-maven-plugin:generate的时候报了一个Unable to load authentication plugin 'caching_sha2_password'的错误。

错误的原因是由于MySQL8.0之后的加密规则为caching_sha2_password,而在此之前的加密规则为mysql_native_password。

解决方法:

mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';

 

你可能感兴趣的:(Java,SQL)