Hive Metadata存MySQL注释中文乱码的问题

参考: http://gengqi88.iteye.com/blog/2040422

解决方案:数据库编码为latin1.将一下表的字段(涉及注释的字段都改)编码设定为UTF8
1、然后进入数据库执行以下5条SQL语句:
(1)修改表字段注解和表注解

1
2
alter table COLUMNS_V2 modify column COMMENT varchar(256) character set utf8;
alter table TABLE_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;

(2) 修改分区字段注解:

1
2
alter table PARTITION_PARAMS  modify column PARAM_VALUE varchar(4000) character set utf8 ; 
alter table PARTITION_KEYS modify column PKEY_COMMENT varchar(4000) character set utf8;

(3)修改索引注解:

1
2
3
4
5
6
7
8
9
alter table  INDEX_PARAMS  modify column PARAM_VALUE  varchar(4000) character set utf8;
```
2、修改hive连接mysql的连接为utf-8
``` xml
<property>
<name></name>
<value>jdbc:mysql://IP:3306/hive?createDatabaseIfNotExist=true&amp;characterEncoding=UTF-8</value>
<description>JDBC connect string for a JDBC metastore</description>
</property>

另参考:
https://my.oschina.net/jackieyeah/blog/742088
http://www.crazyant.net/1193.html