{"id":159589,"date":"2019-10-18T09:01:51","date_gmt":"2019-10-18T01:01:51","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=159589"},"modified":"2019-09-28T11:03:58","modified_gmt":"2019-09-28T03:03:58","slug":"mysql-8-jdbc","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/mysql-8-jdbc.html","title":{"rendered":"MySQL 8.x \u65b0\u7248\u672cJDBC\u8fde\u63a5\u65b9\u5f0f"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nMySQL 8.x \u65b0\u7248\u672cJDBC\u8fde\u63a5\u65b9\u5f0f,\u65e7\u7248\u672c\uff0cMySQL Connector\/J 5.x \u7248\u672c\u7684\u8fde\u63a5\u65b9\u5f0f,MySQL 8.x\u65b0\u7248\u672c\uff0cMySQL Connector\/J 6.x\u4e4b\u540e \u7684\u8fde\u63a5\u65b9\u5f0f,\u65b0\u7248mysql\u9a71\u52a8\u7684url\u5fc5\u987b\u8bbe\u7f6e\u65f6\u533a\uff0c\u5373serverTimezone=UTC\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
1.\u65e7\u7248\u672c\uff0cMySQL Connector\/J 5.x \u7248\u672c\u7684\u8fde\u63a5\u65b9\u5f0f\uff1a<\/strong><\/div>\n
\r\nurl = jdbc:mysql:\/\/localhost:3306\/thrcloud_db01?useUnicode=true&characterEncoding=utf8\r\ndriver-class-name = com.mysql.jdbc.Driver\r\n<\/pre>\n
2\u3001MySQL 8.x\u65b0\u7248\u672c\uff0cMySQL Connector\/J 6.x\u4e4b\u540e \u7684\u8fde\u63a5\u65b9\u5f0f\uff1a<\/strong><\/div>\n
url = jdbc:mysql:\/\/localhost:3306\/thrcloud_db01?serverTimezone=UTC&characterEncoding=utf8&useUnicode=true&useSSL=false\r\ndriver-class-name = com.mysql.cj.jdbc.Driver\r\n<\/pre>\n

\u6ce8\u610f\uff1a\u65b0\u7248mysql\u9a71\u52a8\u7684url\u5fc5\u987b\u8bbe\u7f6e\u65f6\u533a\uff0c\u5373serverTimezone=UTC\uff0c\u5426\u5219\u4f1a\u62a5\u5982\u4e0b\u9519\u8bef\uff1a
\n\"\"<\/p>\n

\r\nJava.sql.SQLException: The server time zone value '\u00d6\u00d0\u00b9\u00fa\u00b1\u00ea\u00d7\u00bc\u00ca\u00b1\u00bc\u00e4' 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.\r\n    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.14.jar:8.0.14]\r\n    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.14.jar:8.0.14]\r\n    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.14.jar:8.0.14]\r\n    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.14.jar:8.0.14]\r\n    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[mysql-connector-java-8.0.14.jar:8.0.14]\r\n    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:76) ~[mysql-connector-java-8.0.14.jar:8.0.14]\r\n    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835) ~[mysql-connector-java-8.0.14.jar:8.0.14]\r\n    at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:455) ~[mysql-connector-java-8.0.14.jar:8.0.14]\r\n    at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240) ~[mysql-connector-java-8.0.14.jar:8.0.14]\r\n    at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.14.jar:8.0.14]\r\n    at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1464) ~[druid-1.0.31.jar:1.0.31]\r\n    at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1529) ~[druid-1.0.31.jar:1.0.31]\r\n    at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2109) ~[druid-1.0.31.jar:1.0.31]\r\nCaused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value '\u00d6\u00d0\u00b9\u00fa\u00b1\u00ea\u00d7\u00bc\u00ca\u00b1\u00bc\u00e4' 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.\r\n    at sun.reflect.GeneratedConstructorAccessor29.newInstance(Unknown Source) ~[na:na]\r\n<\/init><\/pre>\n","protected":false},"excerpt":{"rendered":"

url = jdbc:mysql:\/\/localhost:3306\/thrcloud_db01?useUnic […]<\/p>\n","protected":false},"author":63,"featured_media":159593,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-159589","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/159589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=159589"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/159589\/revisions"}],"predecessor-version":[{"id":160420,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/159589\/revisions\/160420"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/159593"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=159589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=159589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=159589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}