环境:JDK9、MYSQL8、idea
报错信息如下
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'.
根据上面提示修改jdbc.properties配置 中com.mysql.jdbc.Driver 改为 com.mysql.cj.jdbc.Driver
改完后存在以下报错
java.sql.SQLException: 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.
根据报错我们知道这是时间报错,没有指定明确的时区。
正确配置jdbc.properties
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/o2o?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC&useSSL=false
jdbc.username=root
jdbc.password=123456