The server time zone value 'EDT' is unrecognized or represents more than one time zone.

问题:

启动hive时出现以下错误:

Caused by: java.sql.SQLException: The server time zone value 'EDT' 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 com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:545)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:489)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:69)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:1606)
at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:633)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:347)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:361)
at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:416)
... 70 more

解决:

(1)使用 server mysql start命令启动mysql

(2)在mysql中执行show variables like '%time_zone%';

(3)输入select now();

(4)在终端执行date命令

此时发现终端显示的时间和MySql中显示的时间不一致,这就是问题所在。

(5)在mysql中执行 set time_zone=SYSTEM;

(6)再次在mysql中执行select now();

 

(6)执行 set global time_zone='+8:00';

(7)执行 flush privileges;

(7)再次执行hive命令,问题解决。

原文链接:https://blog.csdn.net/u014662563/article/details/61923884

原文地址:https://www.cnblogs.com/zqzhen/p/12894299.html