WIN10下解决HIVE 初始化MYSQL表报错:Unknown version specified for initialization

今天本地WINDOWS装HIVE,走到最后一步初始化数据库死活不通过:
 

D:\hive\hive-rel-release-3.1.3\bin\ext>hive --service schematool -dbType mysql -initSchema --verbose
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/hive/hadoop-3.2.4/share/hadoop/common/lib/slf4j-reload4j-1.7.35.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/hive/hive-rel-release-3.1.3/lib/log4j-slf4j-impl-2.17.1.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.slf4j.impl.Reload4jLoggerFactory]
2023-12-05 22:52:30,336 INFO conf.HiveConf: Found configuration file file:/D:/hive/hive-rel-release-3.1.3/conf/hive-site.xml
2023-12-05 22:52:30,586 INFO tools.HiveSchemaHelper: Metastore connection URL:   jdbc:mysql://localhost/metastore?serverTimezone=GMT%2B8
Metastore connection URL:        jdbc:mysql://localhost/metastore?serverTimezone=GMT%2B8
2023-12-05 22:52:30,587 INFO tools.HiveSchemaHelper: Metastore Connection Driver :       com.mysql.jdbc.Driver
Metastore Connection Driver :    com.mysql.jdbc.Driver
2023-12-05 22:52:30,592 INFO tools.HiveSchemaHelper: Metastore connection User:  hive
Metastore connection User:       hive
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
Starting metastore schema initialization to 3.1.0
org.apache.hadoop.hive.metastore.HiveMetaException: Unknown version specified for initialization: 3.1.0
org.apache.hadoop.hive.metastore.HiveMetaException: Unknown version specified for initialization: 3.1.0
        at org.apache.hadoop.hive.metastore.MetaStoreSchemaInfo.generateInitFileName(MetaStoreSchemaInfo.java:137)
        at org.apache.hive.beeline.HiveSchemaTool.doInit(HiveSchemaTool.java:585)
        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)
*** schemaTool failed ***

错误提示也是很奇葩的不知所云。

有个StackOverflow的据说是解决了但是在我这儿然并卵:

hadoop - Unknown version specified for initialization: 3.1.0 schemaTool failed - Stack Overflowicon-default.png?t=N7T8https://stackoverflow.com/questions/64662650/unknown-version-specified-for-initialization-3-1-0-schematool-failed最后使用最土但是最有效的方法,找到SQL脚本:

hive-rel-release-3.1.3\standalone-metastore\src\main\sql\mysql\hive-schema-3.1.0.mysql.sql

执行成功!终于看到熟悉的命令界面了:

WIN10下解决HIVE 初始化MYSQL表报错:Unknown version specified for initialization_第1张图片

折腾了2个小时,最后最简单的方法还是最有效

你可能感兴趣的:(未整理随笔,hive,mysql,hadoop)