Spring报错:create connection SQLException, url: jdbc:mysql://localhost:3306/mm, errorCode 1251, state

严重: create connection SQLException, url: jdbc:mysql://localhost:3306/mm, errorCode 1251, state 08004
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Client does not suppor

首先将url改成

依然报错 

create connection SQLException, url: jdbc:mysql://localhost:3306/mm?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC, errorCode 1251, state 08004
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Client does not support authentication protocol requested by server; consider upgrading MySQL client
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	

后来发现是mysql-connect的jar包版本不对,我连接的mysql数据库是8.0版本的

然而使用的jar包是5.0版本的。将mysql-connect的jar包版本改为8.0即可

你可能感兴趣的:(spring,mysql,java)