Cause: java.sql.SQLException: Unknown initial character set index '255' received from server.

Cause: java.sql.SQLException: Unknown initial character set index '255' received from server.

原因:

驱动与数据库字符集不匹配

解决方法:

1、换一个新版本的mysql-connector-java。

5.1.44的character_set_server和character_set_database系统变量的默认值已从latin1更改为utf8mb4。

<!--dependency>mysqlmysql-connector-java5.1.17

换成这个

mysqlmysql-connector-java5.1.44

2.在url中添加字符集说明"jdbc:mysql://localhost:3306/mybatis?characterEncoding=utf8"

我用第二种方法,可以正常使用了。

你可能感兴趣的:(Cause: java.sql.SQLException: Unknown initial character set index '255' received from server.)