日期:2014-05-16  浏览次数:20781 次

hive初始化访问mysql权限问题

hive 执行 show tables;

问题

写道
FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Access denied for user 'hive'@'localhost' (using password: YES)
NestedThrowables:
java.sql.SQLException: Access denied for user 'hive'@'localhost' (using password: YES)
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

?然后启动 bin/hive,执行show tables命令 这时报FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Access denied for user 'hive'@'localhost' (using password: YES)。这是因为mysql不允许远程访问的问题,执行?

?

GRANT ALL PRIVILEGES ON *.* TO 'hive'@'localhost' IDENTIFIED BY 'hive' WITH GRANT OPTION;

FLUSH PRIVILEGES;

允许用户hive从ip为localhost的主机连接到mysql服务器,并使用hive作为密码

?

?

然后再执行show tables命令,这时报:FAILED: Error in metadata: javax.jdo.JDODataStoreException: An exception was thrown while adding/validating class(es) : Specified key was too long; max key length is 767 bytes。?
这个问题是因为hive对mysql的UTF-8编码方式有限制,修改一下mysql的编码方式即可:alter database name character set latin1;