linux下hive的meta数据库由默认的derby数据库初始化为window下的mysql出现问题和解决方案

文章列举了初学者在使用Hive时遇到的五个主要问题,包括XML配置文件解析错误、数据库连接失败、MySQL驱动版本不匹配、时区设置问题以及JDBC驱动版本冲突。这些问题分别通过修正XML头部、使用正确网络IP、调整MySQL驱动名、设置服务器时区和更换适合的JDBC驱动版本来解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

初学hive的时候遇到的问题集锦:

hive-site.xml文件的配置如下:

<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> javax.jdo.option.ConnectionDriverName com.mysql.jdbc.Driver driver class 192.168.0.104 javax.jdo.option.ConnectionURL jdbc:mysql://192.168.0.104:3306/hive?serverTimezone=UTC mysql url javax.jdo.option.ConnectionUserName root username javax.jdo.option.ConnectionPassword root mysql passwd hive.metastore.schema.verification false hive.server2.thrift.port 10000 TCP 的监听端口,默认为10000。 Port number of HiveServer2 Thrift interface. Can be overridden by setting $HIVE_SERVER2_THRIFT_PORT hive.server2.thrift.bind.host 0.0.0.0 host设置成0.0.0.0,来接收未知来源的ip Bind host on which to run the HiveServer2 Thrift interface. Can be overridden by setting $HIVE_SERVER2_THRIFT_BIND_HOST hive.metastore.warehouse.dir /user/hive_data location of default database for the warehouse

#初始化mysql为元数据库输入命令:schematool -dbType mysql -initSchema

报错1.hive初始化元数据Error: Syntax error: Encountered “<EOF>“ at line 1, column 64. (state=42X01,code=30000)or
这个错误是因为在hive-site.xml的文件中少了内容,导致无法解析xml文件:  
   本人在该文件开头加上:<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

就可以了。

报错2.:org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version
under by SQLERROE,就是说连接不上作为目的的mysql数据库地址。
原因:我hive-site.xml文件的mysql地址写错了。我电脑用得wifi网络。我应该用WLAN网络的ip地址。可是我却用的是网线的那种ip地址。
 
 报错3:Metastore Connection Driver :	 com.mysql.cj.jdbc.Driver Metastore connection User:	 root org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version. Underlying cause: java.sql.SQLException : No suitable driver found for jdbc:mysql://192.168.0.110:3306/hive_2020_test1?
这个错误的原因是:window下的mysql的版本在6点几以上的时候用的jdbc连接jar包是com.mysql.cj.jdbc.Driver,而我的mysql版本是5.7,我应该在hive-site.xml里写为com.mysql.jdbc.Driver

报错4:org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.

Underlying cause: java.sql.SQLException : 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.
SQL Error code: 0
这个错误的原因是:区时没有设置,在hive-site.xml里设置一下:
jdbc:mysql://192.168.0.110:3306/hive?serverTimezone=UTC

报错5:exception in thread “main”java.lang"noSuchMethodError"
  原因:jdbc的连接jar包不匹配(版本太低,或者版本太高,换个版本的jdbc连接jar即可)
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值