您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

linux下postgres创建hive数据库

bubuko 2022/1/25 20:09:48 其他 字数 3036 阅读 957 来源 http://www.bubuko.com/infolist-5-1.html

操作步骤 ...

操作步骤

#登录
[root@xxx01 ~]# su postgres
bash-4.2$ psql -U postgres
could not change directory to "/root"
psql (9.2.24)
Type "help" for help.

postgres=# \l
                             List of databases
   Name    |  Owner   | Encoding  | Collate | Ctype |   Access privileges   
-----------+----------+-----------+---------+-------+-----------------------
 metastore | hive     | UTF8      | C       | C     | 
 postgres  | postgres | SQL_ASCII | C       | C     | 
 scm       | scm      | UTF8      | C       | C     | 
 template0 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8      | C       | C     | 
(5 rows)
#删除存留的hive数据库
postgres=# drop database metastore;
DROP DATABASE
postgres=# \l
                             List of databases
   Name    |  Owner   | Encoding  | Collate | Ctype |   Access privileges   
-----------+----------+-----------+---------+-------+-----------------------
 postgres  | postgres | SQL_ASCII | C       | C     | 
 scm       | scm      | UTF8      | C       | C     | 
 template0 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8      | C       | C     | 
(4 rows)

## 创建数据库,用户是hive
postgres=# createdb -U hive metastore
postgres-# \l
                             List of databases
   Name    |  Owner   | Encoding  | Collate | Ctype |   Access privileges   
-----------+----------+-----------+---------+-------+-----------------------
 postgres  | postgres | SQL_ASCII | C       | C     | 
 scm       | scm      | UTF8      | C       | C     | 
 template0 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8      | C       | C     | 
(4 rows)
## 拥有者
postgres=# create database metastore owner hive;
CREATE DATABASE
postgres=# \l
                             List of databases
   Name    |  Owner   | Encoding  | Collate | Ctype |   Access privileges   
-----------+----------+-----------+---------+-------+-----------------------
 metastore | hive     | UTF8      | C       | C     | 
 postgres  | postgres | SQL_ASCII | C       | C     | 
 scm       | scm      | UTF8      | C       | C     | 
 template0 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8      | C       | C     | 
(5 rows)
## 权限
postgres=# grant all  on database metastore to hive;
GRANT
postgres=# 

linux下postgres创建hive数据库

原文:https://www.cnblogs.com/JuncaiF/p/12374259.html


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶