初始化HIVE时,执行bin/schematool -dbType mysql -initSchema 报错

初始化HIVE时,执行bin/schematool -dbType mysql -initSchema
报错

异常一:

Metastore connection URL: jdbc:mysql://192.168.56.112/hive-demo?createDatabaseIfNotExist=true&useSSL=false
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: root
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to load driver
Underlying cause: java.lang.ClassNotFoundException : com.mysql.jdbc.Driver
Use --verbose for detailed stacktrace.
在这里插入图片描述
这个是说没有找到jdbc的驱动包。
解决办法:
驱动拷贝:将mysql-connector-java-5.1.47-bin.jar放到hive/lib/下解决问题。

异常二:

SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL: jdbc:derby:;databaseName=metastore_db;create=true
Metastore Connection Driver: org.apache.derby.jdbc.EmbeddedDriver
Metastore Connection User: APP

在这里插入图片描述
这个是说hive在初始化的时候连接的数据库URL是derby而不是自己的数据库,这是由于hive/conf/hive-site.xml,没有写,或者名字有误,在初始化的过程中还是默认使用的hive-default.xml.template 。记得一定要细心(上次看别人写成了hive-site.sh就一直报这个错)。

异常三:

SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
Metastore connection URL: jdbc:mysql://192.168.56.112/hive-demo?createDatabaseIfNotExist=true&useSSL=false
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: root
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
Underlying cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘-demo’ at line 1
在这里插入图片描述
这个问题是说配置文件中的URL路径有错,是因为hive-demo,一个 - 的问题,hive帮你创建元数据库hive-demo数据库的时候识别不出 -
解决方案:自己创建一个hive-demo数据库或者把数据库名改掉就行,比如改成hive。

  • 4
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值