解决 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 specific time zone value if you want to utilize time zone support.
问题:
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 specific time zone value if you want to utilize time zone support.
翻译:java.sql.SQLException服务器时区值“й��ʱ�”无法被识别,或者代表了多个时区。如果希望利用时区支持,则必须配置服务器或JDBC驱动程序(通过“serverTimezone”配置属性)以使用更特定的时区值。
解决问题:
需要在资源文件的配置数据库url后面加上
?serverTimezone=GMT
UTC代表的是全球标准时间 ,但是我们使用的时间是北京时区也就是东八区,领先UTC八个小时。
url=jdbc:mysql://10.17.18.240:3306/hai?serverTimezone=GMT
user=root
password=123456