在hive中创建表时报错
hive (default)> create table student(id int);
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:For direct MetaStore DB connections, we don't support retries at the client level.)
查询百度,问题可能出现在mysql映射hive数据库的字符集上(默认是UTF-8)
在mysql中做如下修改
mysql> ALTER DATABASE metastore CHARACTER SET latin1;
Query OK, 1 row affected (0.00 sec)
重启hive解决
hive (default)> create database test;
OK
Time taken: 1.223 seconds
hive (default)> create table stu(id int, name string);
OK
Time taken: 0.502 seconds
-----------------------------------------二次修改-------------------------------------------------------------
往表中导入数据时又报了类似的错误
解决方法如下
- 先关闭hive
- 进入mysql,将hive对应的库删掉
- 再创建库,并运行以下语句修改字符集
ALTER DATABASE metastore CHARACTER SET latin1;