其他分享
首页 > 其他分享> > Unknown initial character set index '255' received from server. Initial client character s

Unknown initial character set index '255' received from server. Initial client character s

作者:互联网

转载自: https://blog.csdn.net/txwtech/article/details/80787886

 

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

从错误的提示信息中发现字符集设置出现问题

 

 

mysql连接数据库时报此错误:

//String url = "jdbc:mysql://localhost:3306/db_cjky" 如果使用这句就会报错。
//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/db_cjky?useUnicode=true&characterEncoding=utf8";//改成这句,就可以了

 

最终解决方法:

删除 \WebContent\WEB-INF\lib目录下的。mysql-connector的jar文件。原因是:MySQL驱动和数据库字符集设置不搭配

 

再补充一下,如果是在mybatis配置文件中的话应该修改成jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=utf8

 

标签:index,set,Unknown,characterEncoding,character,mysql,Initial
来源: https://www.cnblogs.com/nio-nio/p/13521192.html