DBeaver连接hive中文注释乱码

  1. MySQL服务停⽌止,新增字符集到my.cnf,启动MySQL
su - mysqladmin
service mysql stop
vi /etc/my.cnf
#在[mysqld]后添加以下内容:
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
service mysql start
  1. 强⾏行行指定Hive元数据表的字段字符集为UTF8
mysql -uroot -pruozedata
#hive的元数据库hive,默认是拉丁字符集latin1,⽆无需修改
#切换hive数据库
mysql> use hive;
#修改表字段和表注解
mysql> alter table COLUMNS_V2 modify column COMMENT varchar(256) character set utf8;
mysql> alter table TABLE_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
#修改分区字段注解
mysql> alter table PARTITION_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
mysql> alter table PARTITION_KEYS modify column PKEY_COMMENT varchar(4000) character set utf8;
#修改索引注解
mysql> alter table INDEX_PARAMS modify column PARAM_VALUE varchar(4000) character set utf8;
  1. 删除之前的表,重新建表
  2. DBeaver查看,显示不不乱码
    DBeaver连接hive中文注释乱码_第1张图片

你可能感兴趣的:(hive)