有一次在导入mysql-connector-java的版本时,用的是5.0.4版本,但是报了“Unknown initial character set index ‘255’ received from server. Initial client character set can be forced via the ‘characterEncoding’ property...”的错。
在pom文件中将其改成5.1.44后解决了。
<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.44</version> </dependency>