1 MySQL 新增字符集到my.cnf,启动MySQ
[root@node01 ~]# vim /etc/my.cnf
#添加utf8 解决DBeaver连接hive乱码问题
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
[root@node01 ~]# systemctl restart mysqld
2 mysql指定Hive元数据表的字段字符集为UTF8
mysql -uroot -p
#hive的元数据库hive,默认是拉丁字符集latin1,⽆无需修改
#切换hive 元数据的数据库 hive/metastore
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;
3 删除之前的表,重新建表
4 DBeaver查看,显示不不乱码
DBeaver.png
网友评论