Cause: java.sql.SQLException: Unknown initial character set index '255' received from server.
2020-10-31 10:51
232 查看
原因:
驱动与数据库字符集不匹配
解决方法:
1、换一个新版本的mysql-connector-java。
5.1.44的character_set_server和character_set_database系统变量的默认值已从latin1更改为 utf8mb4。
<groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.17</version> </dependency--> 换成这个 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.44</version> </dependency>
或者
2.在url中添加字符集说明
java"jdbc:mysql://localhost:3306/mybatis?characterEncoding=utf8"
相关文章推荐
- 解决java.sql.SQLException: null, message from server: "Host 'XXX' is not allowed to connect异常
- Solr java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect to this MySQL server
- 报错java.sql.SQLException: null, message from server
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect to this MySQL server"
- java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect异常解决
- 远程mysql_java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host '192.168.1.101' is not allowed to connect
- 远程mysql_java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host '10.11.3.67' is not allowed to connect to t
- java.sql.SQLException: Could not retrieve transaction read-only status from server
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- Cause: java.sql.SQLException: Could not retrieve transation read-only status server
- java.sql.SQLException: General error, message from server: "Field 'ID' doesn't have a default value
- java.sql.SQLException: null, message from server: “Host ‘xxx’ is not allowed to connect
- 远程mysql_java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect
- java.sql.SQLException: null, message from server: "Host 'xxx' is not allowed to connect to this MySQ
- Cause: java.sql.SQLException: Could not retrieve transation read-only status server 异常解决
- java.sql.SQLException: null, message from server: "Host 'XXXXX' is not allowed to connect