hive初始化元数据仓库报错:Underlying cause: java.sql.SQLException : Access denied for user ‘root‘@‘shi1‘ (using

it2026-08-07  4

目录

报错内容

报错原因

原因一

原因二 

解决方案

一的解决方案

二的解决方案


报错内容

which: no hbase in (/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/root/bin:/opt/jdk/bin:/opt/jdk/bin:/opt/zookeeper/bin:/opt/jdk/bin:/opt/zookeeper/bin:/opt/hadoop/bin:/opt/hadoop/sbin:/opt/jdk/bin:/opt/zookeeper/bin:/opt/hadoop/bin:/opt/hadoop/sbin:/opt/hive/bin) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/hive/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/hadoop/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://shi1:3306/hive?createDatabaseIfNotExist=true Metastore Connection Driver : com.mysql.jdbc.Driver Metastore connection User: root org.apache.hadoop.hive.metastore.HiveMetaException: Failed to get schema version. Underlying cause: java.sql.SQLException : Access denied for user 'root'@'shi1' (using password: YES) SQL Error code: 1045 Use --verbose for detailed stacktrace. *** schemaTool failed ***

报错原因

原因一

     在浏览器中输入虚拟机主机ip:50070出现以下内容,说明是由于Hadoop进入安全模式而导致hive初始化失败。

原因二 

MySQL数据库所有用户密码没有统一

解决方案

一的解决方案

    退出Hadoop安全模式:使用stop-dfs.sh命令关闭Hadoop服务然后用start-dfs.sh命令重启(只重启第一台机器就可以),再次在浏览器中输入虚拟机主机ip:50070进行服务验证,括号内由standby变为active即为成功。

    如果重启Hadoop服务没有退出安全模式可以在hdfs-site.xml配置文件中加入以下代码退出

<property> <name>dfs.ha.automatic-failover.enabled.ns</name> <value>true</value> </property>

二的解决方案

进入MySQL数据库

mysql -uroot -p

统一所有用户密码,注意修改下边代码的汉字成自己对应的内容

grant all privileges on *.* to'root'@'主机名'identified by '新密码' with grant option;

刷新MySQL数据库授权

flush privileges;

 

最新回复(0)