) ENGINE
=INNODB : Specified key was too long; max key length is 767 bytes
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too
long; max key length is 767 bytes at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...
at org.apache.hadoop.util.RunJar.main(RunJar.java:
212)
main]: ERROR Datastore.Schema: An exception was thrown
while adding/validating>
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...
at java.lang.reflect.Method.invoke(Method.java:
606) at org.apache.hadoop.util.RunJar.main(RunJar.java:
212)
[main]: DEBUG metastore.HiveMetaStore: admin role already exists
InvalidObjectException(message:Role admin already exists.)
at org.apache.hadoop.hive.metastore.ObjectStore.addRole(ObjectStore.java:
3187) ...
at java.lang.reflect.Method.invoke(Method.java:
606)
[main]: DEBUG metastore.HiveMetaStore: Failed
while granting global privs to admin
InvalidObjectException(message:All is already granted by admin)
at org.apache.hadoop.hive.metastore.ObjectStore.grantPrivileges(ObjectStore.java:
3912) ...
at org.apache.hadoop.util.RunJar.main(RunJar.java:
212)
第四步:继续搜索解决方法,然后找到了可能是字符集的原因,可以通过在mysql中将数据库的字符集改为latin1,执行以下命令: alter database hive character set latin1; 第五步:重启hive,继续看log,除了第一个exception消失了之外,其他依然存在,有些疑惑,认真看了一下,发现metastore.HiveMetaStore: admin role already exists,会不会是之前hive启动出错时留下的问题,那么把mysql中的hive数据删掉重新创建一个看看。 第六步:在mysql中执行以下命令: drop database hive; create database hive; alter database hive character set latin1; 第七步:重启hive,查看log,问题解决了!!!