java.sql.SQLException: Unknown initial character set index '255' received from server for connector 8.0.11

后端 未结 14 2505
感情败类
感情败类 2021-02-14 22:13

While establishing the connection to a MySQL database, I\'m getting the following error

java.sql.SQLException: Unknown initial character set index \'255\' receiv         


        
相关标签:
14条回答
  • 2021-02-14 22:36

    Sounds like you need to download the latest connector j jar:

    http://chillyfacts.com/java-sql-sqlexception-unknown-initial-character-set-index-224-received-server/

    0 讨论(0)
  • 2021-02-14 22:38

    I am using springboot,liquibase, mysql

    I got solution: This error occur just because of mysql connector in dependency and mysql server you install not match(in my case i am using lower version mysql connector and latest mysql server). So just change scope of mysql connector to runtime:

    maven

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
    

    gradle

    dependencies {
    //... other dependencies
    runtimeOnly group:'mysql', name:'mysql-connector-java'
    }
    

    Or if problem yet not solve then use same version or nearby version for both mysql server and mysql connector.

    0 讨论(0)
  • 2021-02-14 22:40

    Adding the following to your connection string should work:

    jdbc:mysql://localhost/yourDB?characterEncoding=latin1;
    
    0 讨论(0)
  • 2021-02-14 22:44

    Use the same version of MySQL as well as mysql-connector. If you are using tomcat then keep the connector in the lib folder of tomcat.

    0 讨论(0)
  • 2021-02-14 22:44

    Setting the CharacterEnconding, useUnicode options will work

    jdbc:mysql://localhost:3306/dbname?characterEncoding=utf8&useSSL=false&useUnicode=true"

    0 讨论(0)
  • 2021-02-14 22:46

    Add connector dependency jar file in the POM file after a cross-check with your MySql server version 8.0.x add this dependency it was working for me mysqlmysql-connector-java 8.0.11

    0 讨论(0)
提交回复
热议问题