HiveSQLException: Error while compiling statement: No privilege 'Create' found for outputs { database:default }

今天用Hive的JDBC实例时出现了HiveSQLException: Error while compiling statement: No privilege ‘Create‘ found for outputs { database:default }的错误,日志如下。

org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: No privilege ‘Create‘ found for outputs { database:default }

       at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:231)

       at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:217)

       at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:254)

       at zimo.hadoop.hive.Hive.main(Hive.java:27)

Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: No privilege ‘Create‘ found for outputs { database:default }

       at org.apache.hive.service.cli.operation.Operation.toSQLException(Operation.java:314)

       at org.apache.hive.service.cli.operation.SQLOperation.prepare(SQLOperation.java:102)

       at org.apache.hive.service.cli.operation.SQLOperation.runInternal(SQLOperation.java:171)

       at org.apache.hive.service.cli.operation.Operation.run(Operation.java:256)

       at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementInternal(HiveSessionImpl.java:376)

       at org.apache.hive.service.cli.session.HiveSessionImpl.executeStatementAsync(HiveSessionImpl.java:363)

       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:497)

       at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:79)

       at org.apache.hive.service.cli.session.HiveSessionProxy.access$000(HiveSessionProxy.java:37)

       at org.apache.hive.service.cli.session.HiveSessionProxy$1.run(HiveSessionProxy.java:64)

       at java.security.AccessController.doPrivileged(Native Method)

       at javax.security.auth.Subject.doAs(Subject.java:422)

       at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)

       at org.apache.hadoop.hive.shims.HadoopShimsSecure.doAs(HadoopShimsSecure.java:536)

       at org.apache.hive.service.cli.session.HiveSessionProxy.invoke(HiveSessionProxy.java:60)

       at com.sun.proxy.$Proxy22.executeStatementAsync(Unknown Source)

       at org.apache.hive.service.cli.CLIService.executeStatementAsync(CLIService.java:270)

       at org.apache.hive.service.cli.thrift.ThriftCLIService.ExecuteStatement(ThriftCLIService.java:401)

       at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1313)

       at org.apache.hive.service.cli.thrift.TCLIService$Processor$ExecuteStatement.getResult(TCLIService.java:1298)

       at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)

       at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)

       at org.apache.hive.service.auth.TSetIpAddressProcessor.process(TSetIpAddressProcessor.java:56)

       at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:206)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

       at java.lang.Thread.run(Thread.java:745)

  从日志可以清楚地看出,出现该错误的原因是因为我们创建的用户没有执行‘Create’操作的权限,所以我们需要将权限授予该用户。

解决办法:

hive> set system:user.name=hadoop;

1.给当前用户权限:

  给用户当前权限:

hive> grant create on database default to user hadoop;

OK

Time taken: 0.146 seconds

  或者给用户所有权限  :

hive> grant all on database default to user hadoop;   

OK

Time taken: 0.146 seconds

2.在其他有权限的数据库里创建表

  比如 当前用户在db1里面有权限,而在default里面是没有的那么可以:

use db1;

create table default.test

(

name string

);

  这样也可以创建。

  然后,我们的问题就能得到解决了!

以上就是博主为大家介绍的这一板块的主要内容,这都是博主自己的学习过程,希望能给大家带来一定的指导作用,有用的还望大家点个支持,如果对你没用也望包涵,有错误烦请指出。如有期待可关注博主以第一时间获取更新哦,谢谢! 


版权声明:本文为博主原创文章,未经博主允许不得转载。

HiveSQLException: Error while compiling statement: No privilege 'Create' found for outputs { database:default }

原文地址:https://www.cnblogs.com/zimo-jing/p/9081282.html

时间: 2024-11-08 13:08:44

HiveSQLException: Error while compiling statement: No privilege 'Create' found for outputs { database:default }的相关文章

Hplsql报错:...HiveSQLExpection:Error while compiling statement:No privilege 'Select' found for inputs {.....}

实践hplsql时,遇到的问题总结一下,若有不对的地方,欢迎交流. 一.Hplsql简介 hplsql的介绍详见:http://lxw1234.com/archives/2015/09/492.htm 二.hpsql的配置文件为hplsql-site.xml 2.1 常见的选项列表: hplsql.conn.default 指定默认的连接配置文件,默认值为hive2conn hplsql.conn.hive2conn 指定HiveServer2JDBC连接 hplsql.conn.init.hi

HiveServer2 的jdbc方式创建udf的修改(add jar 最好不要使用),否则会造成一场 java.sql.SQLException: Error while processing statement: null

自从Hive0.13.0开始,使用HiveServer2 的jdbc方式创建udf的临时函数的方法由: ADD JAR ${HiveUDFJarPath} create TEMPORARY function md5  as 'com.hugedata.hive.udf.codec.UDFMd5'; 改为:     create TEMPORARY function md5  as 'com.hugedata.hive.udf.codec.UDFMd5' USING JAR ${HiveUDFJa

解决hiveserver2报错:java.io.IOException: Job status not available - Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask

用户使用的sql: select count( distinct patient_id ) from argus.table_aa000612_641cd8ce_ceff_4ea0_9b27_0a3a743f0fe3; 下面做不同的测试: 1.beeline -u jdbc:hive2://0.0.0.0:10000 -e "select count( distinct patient_id ) from argus.table_aa000612_641cd8ce_ceff_4ea0_9b27_

docker: Error response from daemon: OCI runtime create failed 解决办法

错误原因 在新服务器上安装好docker后,发现无法运行,经常一顿搜索后,发现是docker安装的版本过高,最新版本docker-18.06 的核心好像没有经过充分的测试就发布了. 导致一运行,就提示: docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:301: runn

How to create a logical standby database based on a physical standby database

The related steps about how to create a phisical standby database please refer:   http://blog.csdn.net/waterxcfg304/article/details/35991771 /* How to create a logical standby database based on a physical standby database   */ 以下是主库: 下列语句可以用来检查SQL应用能

ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema'

在我想把备份的数据库导入到本地数据的时候,发生这个错误,我使用的工具是dbForge Studio for MySQL ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema' 最终发现 通过下拉找到我想导入的数据库,OK了 ERROR 1044 (42000): Access denied for user 'root'@'localhost' to databa

ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'mysql'

mysql> use mysqlERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'mysql'mysql> exitBye[[email protected] ~]# service mysqld stop Stopping mysqld:                                           [  OK  ][[email protected] ~]# mysql

ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'mysql'(转)

解决ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql' 原创 2014年05月11日 11:42:25 # /etc/init.d/mysql stop # mysqld_safe --user=mysql --skip-grant-tables --skip-networking & # mysql -u root mysql mysql> UPDATE user SET Passwor

Error Code: 1786 Statement violates GTID consistency: CREATE TABLE ... SELECT.

1.错误描述 1 queries executed, 0 success, 1 errors, 0 warnings 查询:call account_check_main('20180511') 错误代码: 1786 Statement violates GTID consistency: CREATE TABLE ... SELECT. 执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0.066 sec 2.错误原因 这是因为在5.6及以上的版本内,开启了 enforce_gt