hive 的drop table命令出错
来源:互联网 发布:对锐捷网络的了解 编辑:程序博客网 时间:2024/06/07 07:55
一 前言
今天遇到 如题所示问题,出错内容提示如下
FAILED: Error in metadata: javax.jdo.JDODataStoreException: Error(s) were found while auto-creating/validating the datastore for classes. The errors are printed in the log, and are attached to this exception.
NestedThrowables:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Specified key was too long; max key length is 1000 bytes
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
二 解决方案
网上给出原因是元数据库mysql的编码问题,参见http://sishuok.com/forum/blogPost/list/5596.html
具体解决办法是
linux系统下,修改MySQL数据库默认编码的步骤为:
ü 停止MySQL的运行
/etc/init.d/mysql start (stop) 为启动和停止服务器 ,
ü MySQL主配置文件为my.cnf,一般目录为/etc/mysql
var/lib/mysql/ 放置的是数据库表文件夹,这里的mysql相当于windows下mysql的date文件夹
ü 当我们需要修改MySQL数据库的默认编码时,需要编辑my.cnf文件进行编码修改,在linux下修改mysql的配置文件my.cnf,文件位置默认/etc/my.cnf文件
找到客户端配置[client] 在下面添加
default-character-set=utf8 默认字符集为utf8
在找到[mysqld] 添加
default-character-set=utf8 默认字符集为utf8
init_connect='SET NAMES utf8' (设定连接mysql数据库时使用utf8编码,以让mysql数据库为utf8运行)
修改好后,重新启动mysql 即可,重新查询数据库编码可发现编码方式的改变:
>show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
此时打开hive cli, 使用drop table 命令,成功执行。
附,参考资料《mysql修改编码》
- hive 的drop table命令出错
- Hive drop table卡住的问题
- Hive Create/Drop/Bucketed Table
- drop table命令
- 缓慢的Drop Table
- drop table的优化
- SQL DROP TABLE的用法
- oracle drop table的用法
- 误 drop table 的恢复
- SQL DROP TABLE的用法
- 回收drop table的权限
- Mysql命令drop table:删除数据表
- MySQL命令drop table:删除数据表
- truncate table和drop table的区别
- drop命令的关键字
- PostgreSQL 执行Drop Table等命令型SQL的总体流程
- OCP-1Z0-051 补充题库 第42题 DROP TABLE命令的影响
- Truncate table,Delete From table,与Drop table的区别
- LevelDB的实现原理
- 数据库启动过程图及SCN讲解
- 【ADO.NET】数据库操作
- Android编译系统及命令分析
- jquery获取元素
- hive 的drop table命令出错
- ubuntu apt源
- 获得document的iframe时有两种方法
- 杭电水题--1196 Lowest Bit (bitset:to_string有关问题)
- BackTrack5 学习笔记四
- 使用七牛储存 Octopress 图片
- hdu 3480 Division
- JAVA文件上传(1)
- 配置linux服务器以及root权限的获取