jdbc连接数据库——时区报错
报错内容:
*: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后加上:?serverTimezone=UTC&characterEncoding=utf-8。同时解决了时区差异报错和输入中文报错。
例如:“jdbc:mysql://localhost:3306/ssh_design?serverTimezone=UTC&characterEncoding=utf-8”