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

后端 未结 14 2509
感情败类
感情败类 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:48

    Use Version 5.1.44 of mysql-connector-java.

    <dependency>
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
       <version>5.1.44</version>
    </dependency>
    
    0 讨论(0)
  • 2021-02-14 22:49

    it is because of mysql-connector version , i,e. My-sql install version and dependency version did not match.

    use same version for myS

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

    Using MySQLWorkbench interface:

    First click in your connection ->

    After click in Options File

    And change character-set-server and collation-server values to the values below:

    Make sure to restart mysql server by opening services and restarting mysql server.

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

    The way I fixed it : Add characterEncoding=utf8 to the end of jdbc connection string

    E.g. connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/photo_app?" + "user=root&password=root&characterEncoding=utf8");

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

    You can add ?characterEncoding=latin1" after your url String like this for e.g.:

    "jdbc:mysql://localhost/yourDB?characterEncoding=latin1";
    

    It might work.

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

    Compatible version of mysql-connector-java should be required as per installed MySQL Server ---> For my installed MySQL Server 8.0 I download mysql-connector-java-8.0.20 in SoapUi/bin/ext folder or build path of project in eclipse. it works for me!!

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