当我们输入./schematool -initSchema -dbType mysql的时候,会出现以下错误
Metastore connection URL: jdbc:mysql://192.168.*./hive?createDatabaseIfNotExist=true
Metastore Connection Driver : com.mysql.jdbc.Driver
Metastore connection User: hiveuser
Starting metastore schema initialization to 2.1.0
Initialization script hive-schema-2.1.0.mysql.sql
Error: Duplicate key name ‘PCS_STATS_IDX’ (state=42000,code=1061)
org.apache.hadoop.hive.metastore.HiveMetaException: Schema initialization FAILED! Metastore state would be inconsistent !!
Underlying cause: java.io.IOException : Schema script failed, errorcode 2
Use –verbose for detailed stacktrace.
* schemaTool failed *
以上错误查看mysql是否已经创建了hive这个表, 如果创建,你想从新安装的话,把那个你创建的表删了即可。