MySQL8:Unknown initial character set index ‘255‘ received from server. Initial client character 解决方法

Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.

Found a problem with the character set setting from the wrong message

 

 

This error is reported when mysql connects to the database:

//String url = "jdbc:mysql://localhost:3306/mybatis" If you use this sentence, you will get an error.
//Unknown initial character set index '255' received from server. Initial client character set can be forced via
the'characterEncoding ' property. String url = "jdbc:mysql://localhost:3306/mybatis?useUnicode=true&characterEncoding=utf8" ;//Change to this sentence, that's it

 

The final solution:

Delete in the \WebContent\WEB-INF\lib directory. The jar file of mysql-connector. The reason is: MySQL driver and database character set settings do not match

Guess you like

Origin blog.csdn.net/sky2line/article/details/112392621