JDBC连接错误:The server time zone value '��' is unrecognized or represents more than one time zone.

出错信息:

            com.mysql.cj.core.exceptions.InvalidConnectionAttributeException: 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.

错误描述:

           服务器时区值“InclutionEnter”被识别或表示多个时区。如果要使用时区支持,则必须配置服务器或JDBC驱动程序(通过serverTimezone配置属性)以使用更具体的时区值。

 解决方法:

            第一种解决方案

 Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/myrount?serverTimezone=UTC", "root", "12345678");

            第二种解决方案

在mysql中设置时区,默认为SYSTEM set global time_zone='+8:00'

 

你可能感兴趣的:(#,java,web常见错误)