目前所出现的问题
1、驱动包更新为 mysql-connector-java-8.0.12.jar
2、hibernate的配置文件hibernate.cfg.xml中使用
<property name="connection.driver_class">com.mysql.cj.jdbc.Driver</property>
取代之前的
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
3、出现报错
The server time zone value ‘Öйú±ê׼ʱ¼ä’ is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
乱码问题
(1)网上多种说法是
<property name="connection.url">jdbc:mysql://localhost:3306/day01?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC</property>
继续报错
Error on line 20 of document : 对实体 "characterEncoding" 的引用必须以 ';' 分隔符结尾。 Nested exception: 对实体 "characterEncoding" 的引用必须以 ';' 分隔符结尾。
(2)修改
<property name="connection.url">jdbc:mysql://localhost:3306/day01?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC</property>
解决乱码和 时区的问题。
目前这是使用了mysql8 后出现问题!后续出现问题,在来更新