shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

springboot can not connect mysql 8.0.19 by sharding proxy

Open ryan8926 opened this issue 6 years ago • 6 comments

i need use spring-boot 2.1.7.RELEASE to connect sharding-proxy, but error !

mysql version is 8.0.19,i use mysql driver version is 8.0.19 and this jar in shardling lib also is 8.0.19, but my application start error, error :Caused by: com.mysql.cj.exceptions.UnableToConnectException: CLIENT_PLUGIN_AUTH is required.

application part code:

  @Bean(name = "dataSource") 
  public HikariDataSource dataSource() {
	  HikariConfig config = new HikariConfig();
	  config.setDriverClassName("com.mysql.cj.jdbc.Driver");
	  config.setJdbcUrl(dataSourceUrl); // 数据源 
	  config.setUsername(user); // 用户名
	  config.setPassword(password); // 密码 
	  HikariDataSource ds = new HikariDataSource(config); 
	  return ds; 
  }

<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>

<properties>
	<java.version>1.8</java.version>
</properties>

<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter</artifactId>
	</dependency>

	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
	</dependency>
	
	<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>tomcat-jdbc</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
   
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.19</version>
    </dependency>

ryan8926 avatar Feb 03 '20 05:02 ryan8926

can you show some error details?

kimmking avatar Feb 03 '20 07:02 kimmking

You can use mysql-driver with 5.1.47 and retry.

kimmking avatar Feb 04 '20 05:02 kimmking

You can use mysql-driver with 5.1.47 and retry.

it's can't ,too

RainElohim avatar Feb 10 '20 10:02 RainElohim

proxy4.0.0 [2020-02-10 19:28:30,434] [ERROR] [DruidDataSource:2755] ===> create connection SQLException, url: jdbc:mysql://10.16.0.21:3307/sharding_db?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true, errorCode 0, state 08001 java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) ~[mysql-connector-java-8.0.19.jar:8.0.19] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.19.jar:8.0.19] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.19.jar:8.0.19] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.19.jar:8.0.19]

RainElohim avatar Feb 10 '20 11:02 RainElohim

Duplicate with #3097.

tuohai666 avatar Feb 11 '20 02:02 tuohai666

proxy4.0.0 [2020-02-10 19:28:30,434] [ERROR] [DruidDataSource:2755] ===> create connection SQLException, url: jdbc:mysql://10.16.0.21:3307/sharding_db?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true, errorCode 0, state 08001 java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110) ~[mysql-connector-java-8.0.19.jar:8.0.19] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.19.jar:8.0.19] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.19.jar:8.0.19] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.19.jar:8.0.19]

the driver in your project should be changed to 5.1.47 too.

kimmking avatar Feb 13 '20 10:02 kimmking