当前位置: 代码迷 >> 综合 >> Unknown initial character set index '255' received from server. Initial client character. 解决方案
  详细解决方案

Unknown initial character set index '255' received from server. Initial client character. 解决方案

热度:66   发布时间:2024-01-10 23:11:07.0

原因:

  MySQL驱动和数据库字符集设置不搭配

修改连接字符串为

Connection connection = null; // 后续捕获异常
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/maven?useUnicode=true&characterEncoding=utf8", "账号", "密码");

 

列出我出错的语句(未匹配数据库字符集):

Connection connection = null; // 后续捕获异常
connection = DriverManager.getConnection("jdbc:mysql:///maven","root", "root");

要访问的数据库名:maven

账号:root

密码:root

请对照自己的修改

  相关解决方案