Hive部署安装时,Specified key was too long; max key length is 767 bytes

Specified key was too long; max key length is 767 bytes

============================================

这个是需要mysql中的数据库表及字段编码为latin1。

所以需要修改表库、表和表的字符集为latin1。

查看字符集应该是这样的:

mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | latin1                     |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)


其次就是修改字符集为latin1:

修改表的默认字符集:

ALTER TABLE table_name DEFAULT CHARACTER SET character_name;

修改表字段的默认字符集:

ALTER TABLE table_name CHANGE field field field_type CHARACTER SET character_name [other_attribute]

修改表的默认字符集和所有列的字符集:

ALTER TABLE table_name CONVERT TO CHARACTER SET character_name

=======================================


## database
ALTER DATABASE hive DEFAULT CHARACTER SET latin1;

## table

ALTER TABLE BUCKETING_COLS            CONVERT TO CHARACTER SET latin1; 
ALTER TABLE CDS                       CONVERT TO CHARACTER SET latin1; 
ALTER TABLE COLUMNS_V2                CONVERT TO CHARACTER SET latin1; 
ALTER TABLE DATABASE_PARAMS           CONVERT TO CHARACTER SET latin1; 
ALTER TABLE DBS                       CONVERT TO CHARACTER SET latin1; 
ALTER TABLE DB_PRIVS                  CONVERT TO CHARACTER SET latin1; 
ALTER TABLE FUNCS                     CONVERT TO CHARACTER SET latin1; 
ALTER TABLE FUNC_RU                   CONVERT TO CHARACTER SET latin1; 
ALTER TABLE GLOBAL_PRIVS              CONVERT TO CHARACTER SET latin1; 
ALTER TABLE IDXS                      CONVERT TO CHARACTER SET latin1; 
ALTER TABLE INDEX_PARAMS              CONVERT TO CHARACTER SET latin1; 
ALTER TABLE NUCLEUS_TABLES            CONVERT TO CHARACTER SET latin1; 
ALTER TABLE PARTITIONS                CONVERT TO CHARACTER SET latin1; 
ALTER TABLE PARTITION_KEYS            CONVERT TO CHARACTER SET latin1; 
ALTER TABLE PARTITION_KEY_VALS        CONVERT TO CHARACTER SET latin1; 
ALTER TABLE PARTITION_PARAMS          CONVERT TO CHARACTER SET latin1; 
ALTER TABLE PART_COL_STATS            CONVERT TO CHARACTER SET latin1; 
ALTER TABLE ROLES                     CONVERT TO CHARACTER SET latin1; 
ALTER TABLE ROLE_MAP                  CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SDS                       CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SD_PARAMS                 CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SEQUENCE_TABLE            CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SERDES                    CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SERDE_PARAMS              CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SKEWED_COL_NAMES          CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SKEWED_COL_VALUE_LOC_MAP  CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SKEWED_STRING_LIST        CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SKEWED_STRING_LIST_VALUES CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SKEWED_VALUES             CONVERT TO CHARACTER SET latin1; 
ALTER TABLE SORT_COLS                 CONVERT TO CHARACTER SET latin1; 
ALTER TABLE TABLE_PARAMS              CONVERT TO CHARACTER SET latin1; 
ALTER TABLE TAB_COL_STATS             CONVERT TO CHARACTER SET latin1; 
ALTER TABLE TBLS                      CONVERT TO CHARACTER SET latin1; 
ALTER TABLE TBL_COL_PRIVS             CONVERT TO CHARACTER SET latin1; 
ALTER TABLE TBL_PRIVS                 CONVERT TO CHARACTER SET latin1; 
ALTER TABLE VERSION                   CONVERT TO CHARACTER SET latin1; 



你可能感兴趣的:(Hive部署安装时,Specified key was too long; max key length is 767 bytes)