1.刪除空數據庫
hive>drop database db_hive2;
2.如果刪除的數據庫不存在,最好采用 if exists判斷數據庫是否存在
hive> drop database db_hive; FAILED: SemanticException [Error 10072]: Database does not exist: db_hive hive> drop database if exists db_hive2;
3.如果數據庫不為空,可以采用cascade命令,強制刪除
hive> drop database db_hive; FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. InvalidOperationException(message:Database db_hive is not empty. One or more tables exist.) hive> drop database db_hive cascade;