搭建Hive远程模式在初始化Hive的时候报错Access denied for user ‘hiveowner‘@‘127.0.0.1‘ (using password: YES)

报错信息如下:

 

[root@bigdata11 conf]# schematool -dbType mysql -initSchema
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/root/training/apache-hive-2.3.0-bin/lib/log4j-slf4j-impl-2.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/root/training/hadoop-2.7.3/share/hadoop/common/lib/slf4j-log4j12-1.7.10.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://localhost:3306/hive?useSSL=false
Metastore Connection Driver :     com.mysql.jdbc.Driver
Metastore connection User:     hiveowner
org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version.
Underlying cause: java.sql.SQLException : Access denied for user 'hiveowner'@'127.0.0.1' (using password: YES)
SQL Error code: 1045
Use --verbose for detailed stacktrace.
*** schemaTool failed ***
根据报错信息可以看出时权限的问题

Access denied for user 'hiveowner'@'127.0.0.1' (using password: YES)
SQL Error code: 1045

查看MySQL用户表的权限

root@db 00:30:  [mysql]> select user,host,authentication_string from user;

修改hiveowner用户的权限

 root@db 02:07:  [mysql]> delete from user where user='hiveowner' and host='%';
root@db 02:07:  [mysql]> flush privileges;

root@db 02:07:  [mysql]> select user,host,authentication_string from user;

为了可以远程hiveowner用户,需要把此用户改为所有权限

root@db 02:07:  [mysql]> update user set host='%' where user='hiveowner';

root@db 02:15:  [mysql]> flush privileges;
root@db 02:15:  [mysql]> select user,host,authentication_string from user;


再次初始化hive

[root@bigdata11 conf]# schematool -dbType mysql -initSchema

证明已经初始化成功。

查看hive-schema-2.3.0.mysql.sql脚本

[root@bigdata11 apache-hive-2.3.0-bin]# find . -name hive-schema-2.3.0.mysql.sql

进到MySQL数据库中,查看在hive数据库的中初始化生成的表

或者使用Navicat for MySQL工具查看

通过以上的信息可以证明初始化成功

欢迎大佬们扫下面二维码关注我个人微信公众号(Java大数据架构师成长之路)

 

[root@localhost lib]# schematool -dbType mysql -initSchema -verbose Metastore connection URL: jdbc:mysql://localhost/hive_metastore?useSSL=false&serverTimezone=UTC Metastore Connection Driver : com.mysql.cj.jdbc.Driver Metastore connection User: hive org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version. Underlying cause: java.sql.SQLException : Access denied for user 'hive'@'localhost' (using password: YES) SQL Error code: 1045 org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version. at org.apache.hadoop.hive.metastore.tools.HiveSchemaHelper.getConnectionToMetastore(HiveSchemaHelper.java:94) at org.apache.hive.beeline.HiveSchemaTool.getConnectionToMetastore(HiveSchemaTool.java:169) at org.apache.hive.beeline.HiveSchemaTool.testConnectionToMetastore(HiveSchemaTool.java:475) at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:581) at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:567) at org.apache.hive.beeline.HiveSchemaTool.main(HiveSchemaTool.java:1517) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.hadoop.util.RunJar.run(RunJar.java:323) at org.apache.hadoop.util.RunJar.main(RunJar.java:236) Caused by: java.sql.SQLException: Access denied for user 'hive'@'localhost' (using password: YES) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:829) at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:449) at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:242) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at org.apache.hadoop.hive.metastore.tools.HiveSchemaHelper.getConnectionToMetastore(HiveSchemaHelper.java:88) ... 11 more *** schemaTool failed ***
06-17
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值