Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
時光问题描述
在执行Sql时遇到了如下错误
1 | Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property. |
解决方案
1、在连接数据库时指定字符集
1 | jdbc.url=jdbc:mysql://localhost:3306/mybatis?useUnicode=true&characterEncoding=utf8 |
在主配置文件填写url应该选用&
,如果是在java中需要用 &
2、检查Mysql驱动配置是否正确
因为我本地使用的Mysql的版本是8,而导入依赖的版本是5,修改后重新加载依赖就正常了
1 | <!-- MySQL驱动 --> |
需要注意的是,不同版本的Mysql驱动地址有所区别
1 | # Mysql 5 |
参考
【mybatis】遇到的问题(Unknown initial character set index ‘255‘ received from server)
Unknown initial character set index ‘255’ received from server. 解决方法
原创Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 時光!
评论
匿名评论隐私政策
✅ 你无需删除空行,直接评论以获取最佳展示效果