启动Hive报错:mysql://localhost:3306/hive?createDatabaseIfNotExist=true, username = root. Terminating con

mysql://localhost:3306/hive?createDatabaseIfNotExist=true, username = root. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
在mysql中对root用户进行授权:
登录mysql之后操作:
GRANT ALL PRIVILEGES ON*.* TO ‘root’@‘127.0.0.1’ Identified by ‘111111’;
在这里插入图片描述
再在hive安装目录中的bin目录下执行hive,运行结果如下:
在这里插入图片描述

hive安装配置过程中还需要注意的一些问题:
–>hive 2.0以上版本,安装配置完成之后需要先初始化元数据库
执行: schematool -dbType mysql -initSchema
–>比如一定要把这个mysql-connector-java-5.1.40-bin.jar包放在hive安装目录的lib下,不能是包含这个这个包的压缩包等。
–>Exception in thread “main” java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.ql.metadata.SessionHiveMetaStoreClient
这个错误应该就是没有正确的将jar包放在Lib目录下。
–>启动hive过程中还遇到过,报这个警告,但是可以启动,
Sat Nov 02 15:42:13 CST 2019 WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
有说在hive配置文件中的mysql连接url中加一个参数的,因为原因是MySQL在高版本需要指明是否进行SSL连接。解决方案如下:
在mysql中查看有没有开启ssl
mysql> show global variables like ‘%ssl%’;
如果是have_ssl 对应disabled,那就在hive配置文件conf/hive-site.xml中的mysql连接url中添加参数useSSL=false
即把这一句
在这里插入图片描述
中的createDatabaseIfNotExist=true去掉,换成useSSL=false即可成功,一直尝试在原来的后面加&useSSL=false,一直不行,但是去掉原来的参数就可以了。
在这里插入图片描述
原来还报警告呢,换了之后就ok了!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值