Hive创建数据库时报错【Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException】(已解决)

Hive创建数据库时报错【Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException】(已解决)

版本信息

  • hive : 2.3.4
  • mysql: 5.7.25
  • mysql驱动包:5.11
  • 系统:centos6.5

前置操作

输入show databases;无异常,输入create database db_test;出现报错原因

解决思路

hive -hiveconf hive.root.logger=DEBUG,console

使用debug模式启动,重现bug,启动无异常,输入create database db_test;出现下面报错,推断应该是编码问题,mysql默认是latin1编码

FAILED: ParseException line 1:0 character '˚' not supported here
line 1:1 character '˚' not supported here
2019-04-25T13:31:18,364 ERROR [0f3b65fb-3dc0-470e-86a8-e071bd5ec51e main] ql.Driver: FAILED: ParseException line 1:0 character '˚' not supported here
line 1:1 character '˚' not supported here
org.apache.hadoop.hive.ql.parse.ParseException: line 1:0 character '˚' not supported here
line 1:1 character '˚' not supported here
	at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:217)
	at org.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:77)
	at org.apache.hadoop.hive.ql.parse.ParseUtils.parse(ParseUtils.java:70)
	at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:468)
	at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1317)
	at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1457)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1237)
	at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1227)
	at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:233)
	at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:184)
	at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:403)
	at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:821)
	at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:759)
	at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:686)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
	at org.apache.hadoop.util.RunJar.main(RunJar.java:136)


解决办法

  • 实现创建好hive的数据库并指定编码格式为utf8

    create database hivedb charset=utf8;
    
  • 数据库名为hive-site.sh配置文件中的数据库连接中的配置

  • 重启hive,解决

你可能感兴趣的:(hive)