起因是我把访问权限都配置为 :
GRANT ALL PRIVILEGES ON*.* TO 'hive' Identified by 'hive';
本机地址: 192.168.103.43 机器名字:hadoop1
flush privileges;
启动hive 发生如上的错误;
查看详细错误:${HIVE_HOME}/bin/hive -hiveconf hive.root.logger=DEBUG,console
得到如下的错误信息(当然 不同的问题所产生的日志是不同的):
Caused by: javax.jdo.JDOFatalDataStoreException: Unable to open a test connection to the given database. JDBC url = jdbc:mysql://localhost:3306/hive?createDatabaseIfNotExist=true, username = hive. Terminating connection pool (set lazyInit to true if you expect to start your database after your app). Original Exception: ------
java.sql.SQLException: Access denied for user 'hive'@'127.0.0.1' (using password: YES)
发现数据库的权限 HIVE需要的是: hive'@'127.0.0.1' 这个IP地址
然后试着在mysql中加上权限:
GRANT ALL PRIVILEGES ON*.* TO 'hive'@'%' Identified by 'hive';
GRANT ALL PRIVILEGES ON*.* TO 'hive'@'localhost' Identified by 'hive';
GRANT ALL PRIVILEGES ON*.* TO 'hive'@'127.0.0.1' Identified by 'hive';
GRANT ALL PRIVILEGES ON*.* TO 'hive'@'hadoop1' Identified by 'hive';
flush privileges;
再次启动hive成功:bin/hive