首次启动Hive初始化元数据库不成功?

问题遇到的现象和发生背景

所有节点的配置都搭载好了 ,但是初始化元数据库却报错

问题相关代码,请勿粘贴截图

schematool -dbType mysql -initSchema

运行结果及报错内容

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/software/hive-3.1.2/lib/log4j-slf4j-impl-2.10.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/software/hadoop-3.1.4/share/hadoop/common/lib/slf4j-log4j12-1.7.25.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://mynode2:3306/hive?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.MySQLNonTransientConnectionException : Public Key Retrieval is not allowed
SQL Error code: 0
Use --verbose for detailed stacktrace.
*** schemaTool failed ***

我的解答思路和尝试过的方法
我想要达到的结果

初始化成功显示completed

您这个应该用的是MySQL8吧,用的8的话,您的连接串需要加一个参数呢

allowPublicKeyRetrieval=true

加上这个就可以了呢

mysql-uroot-p登陆然后删除hive表

  1. cd到apache-hive目录下的conf
  2. vim hive-site.xml
  3. img


    在连接串后面加上:allowPublicKeyRetrieval=true
  4. 保存并退出