hive本地模式 schematool无法初始化mysql数据库

异常信息:

[root@kdg01 bin]#  schematool -initSchema -dbType mysql

which: no hbase in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/tmp/myshell:/root/myshell:/usr/mysoft/jdk1.8.0_111/bin:/usr/mysoft/jdk1.8.0_111/bin:/usr/mysoft/hadoop-2.6.5/bin:/usr/mysoft/hadoop-2.6.5/sbin:/usr/local/mysql/bin:/kdg/hive2/bin:/root/bin)

SLF4J: Class path contains multiple SLF4J bindings.

SLF4J: Found binding in [jar:file:/kdg/hive2/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: Found binding in [jar:file:/usr/mysoft/hadoop-2.6.5/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]

SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

Metastore connection URL:    jdbc:mysql://192.168.200.10:3306/hive_class?createDatabaseIfNotExist=true

Metastore Connection Driver :      com.mysql.jdbc.Driver

Metastore connection User:   mysql

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

Underlying cause: java.sql.SQLException : Access denied for user 'mysql'@'kdg01' (using password: YES)

SQL Error code: 1045

Use --verbose for detailed stacktrace.

*** schemaTool failed ***

原因:

密码错误。用这个账号和密码登录mysql能够登录,但是当用schematool对mysql进行初始化的时候却出错。原因就在于mysql的安装。。。。利用hive初始化数据库的时候是随机找的,可能找到的是没有密码,和hive-site.xml文件中的配置不匹配,导致出错。这个mysql是用来装元数据的。

 

问题解决

最终问题解决:    把数据库里面的不是%的数据全部删除【确保hive-site.xml中配置正确的前提下】

注: '%'表示全部用户

现象描述:

Hive本地模式schematool无法初始化mysql数据库。

mysql -uroot -p1        【希望用谁关联hive就用谁登陆】

select host from user;

delete from user where host<>'%';

select host from user;

exit

service mysqld restart

 

schematool -initSchema -dbType mysql

  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值