1.hive (gmall)> desc dws_uv_detail_day;
发现字段comment乱码:
![e34b23a94f1f81123ad7a6d6088fc461.png](https://i-blog.csdnimg.cn/blog_migrate/fae725ea91697b798fa3e8fa8969c498.jpeg)
2.登录mysql,
![00d981dcc5b99857b530de6e01475836.png](https://i-blog.csdnimg.cn/blog_migrate/fd4f215b5b4633dbd451b1161dccb64c.png)
3.进入mysql中hive的元数据库
mysql>use metastore;
mysql>show create table COLUMNS_V2; --查看字符集
![947c2a3b353036c7c3b354b5415961f9.png](https://i-blog.csdnimg.cn/blog_migrate/36b42be0e4eff189aad48ee5d45bb561.jpeg)
4.修改字符集为utf-8
![de49819349c264fb63e87321bfefd025.png](https://i-blog.csdnimg.cn/blog_migrate/fe3c31cceebbc1a525a7208ebfed4513.jpeg)
#修改表字段注解和表注解
5.进入hive的配置文件hive-site.xml 修改javax.jdo.option.ConnectionURL的value
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.130.102:3306/hive_remote?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8</value>
</property>
6.重启hive客户端,删掉之前的表结构,再新建表结构
hive>drop table dws_uv_detail_day;
新建表结构
![e7174dfbd42ebcf6766c8451737fb861.png](https://i-blog.csdnimg.cn/blog_migrate/bf4c4c04a0a8cbd4e226c8df0370c252.jpeg)