搭建SSM项目的时候,数据库连接配置完成之后,启动项目报错,报错信息:
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.
分析上边的错误得知,该错误是imysql的时区错误,没有指定时区。
在配置文件后边添加 serverTimezone=UTC
例如在db.properties的数据库配置文件中添加:
datasource.url=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&serverTimezone=UTC