Spark sql 访问hive数据库,报时区错误

Caused by: 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.

三台虚拟机,安装了spark全分布、hadoop全分布、hive(配置了mysql远程连接)
打开spark-shell 通过 spark-shell操作hive。于是一直报这个错。

网上浏览之后,了解到这是时区问题,在 JDBC 的连接 url 部分加上 serverTimezone=UTC 即可。
于是我就去修改hive 安装目录下的hive-site.xml文件。

除了加serverTimezone=UTC ,我也试过加 serverTimezone=GMT2B%8

img

但是,spark-shell操作hive时还是报相同的错。

改为重启?