idea连接mysql数据库报java.lang.RuntimeException: com.mysql.cj.exceptions.InvalidConnectionAttributeExcepti
转载地址:https://blog.csdn.net/q97052252/article/details/89042882
报错:java.lang.RuntimeException: com.mysql.cj.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.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
解决方法
jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
推荐阅读
-
在IDEA中用jdbc技术通过配置文件连接mysql数据库连接池
-
Eclipse使用jdbc连接MySql数据库报:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES)
-
IDEA连接mysql数据库报错的解决方法
-
使用IDEA配置Tomcat和连接MySQL数据库(JDBC)详细步骤
-
IDEA无法连接mysql数据库的6种解决方法大全
-
在IntelliJ IDEA中使用Java连接MySQL数据库的方法详解
-
Java基础MAC系统下IDEA连接MYSQL数据库JDBC过程
-
Idea连接MySQL数据库出现中文乱码的问题
-
IDEA使用JDBC安装配置jar包连接MySQL数据库
-
远程连接mysql数据库报“Communications link failure...”错误_MySQL