摘要
Spring maven 项目运行报is unrecognized or represents more than one time zone错误解决办法
Spring maven 项目运行报is unrecognized or represents more than one time zone错误解决办法
Spring 项目中执行Dao层时报如下错误:
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. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
解决办法:
只需要修改application.properties文件中的数据库连接url中的信息,将url改成如下格式:
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/beBianMin?serverTimezone=UTC
即在url后面添加serverTimezone=UTC即可解决