Unable to load authentication plugin 'caching_

2020-07-11 08:01发布

I'm getting error

Cannot establish a connection to jdbc:mysql://localhost:3306/world?zeroDateTimeBehavior=convertToNull using com.mysql.jdbc.Driver (Unable to load authentication plugin 'caching_sha2_password'.)

in netbean established the connection.

enter image description here

2条回答
乱世女痞
2楼-- · 2020-07-11 08:40

follow these steps:

  • just turn off the firewall on the system and security on control panel,
  • create a new dynamic web project
  • copy all the class fields and java files from the project
  • add jar in build path version 8.0
  • select tomcat in project facets
  • copy jAR in lib
  • try running jdbcconnection program

it will run.

查看更多
趁早两清
3楼-- · 2020-07-11 08:54

The newer versions of MySQL default to caching_sha2_password. If you want to disable it then follow below steps

  1. Login in to your MYSQL console as root user like below.

eg mysql -u YOUR_ROOT_USER_NAME -p YOUR_ROOT_USER_PASSWORD

  1. Then execute the command by replacing YOUR_ROOT_USER_NAME and YOUR_ROOT_USER_PASSWORD

ALTER USER 'YOUR_ROOT_USER_NAME'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_ROOT_USER_PASSWORD';

You will no longer get any 'caching_sha2_password' exception while connecting for any client after this.

查看更多
登录 后发表回答