在测试JDBC连接mysql时,由于下载的mysql驱动版本为最新的,导致连接数据库时,URL需要添加指定的时区:serverTimezone
这里我的报错为:
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.
针对上面的问题解决的办法是,将配置文件中的“url”后面加上指定的时区,将其值改为“url=jdbc:mysql://localhost:3306/database?serverTimezone=Asia/Shanghai”。