0
点赞
收藏
分享

微信扫一扫

OpenGauss 使用记录

草原小黄河 2022-03-16 阅读 36

概述

华为开源的opengauss数据库基于postgresql,所以pg的用法90%适用于opengauss数据库。

使用技巧

  1. pg_hba.conf 需配置访问数据库的机器IP,并设置访问方式,貌似必须为sha权限:

OpenGauss 使用记录_opengauss

  1. 启动/停止/重启数据库
# 需切换到omm用户,即安装opengauss的用户
root# su - omm
# 启动数据库
omm# gs_om -t start
# 停止数据库
omm# gs_om -t stop
# 重启数据库
omm# gs_om -t restart
  1. 登录数据库
# 以默认数据库登录(安装时配置的数据库端口26000)
omm# gsql -p 26000 -d postgres
# 以指定用户登录数据库
omm# gsql -p 26000 -d postgres -U omm
  1. 创建用户
# 登录后执行postgresql的命令
postgres=# create user psm with password 'XXXXXX';
  1. 创建schema
postgres=# create schema psm authorization psm;
  1. 给用户授权
postgres=# grant all privileges on schema psm to psm;
postgres=# alter user psm with sysdba;
  1. 创建数据库
postgres=# create database psm owner psm;
  1. 常用命令
postgres=# \l #显示所有数据库
postgres=# \c database_name #切换当前数据库到指定数据库
postgres=# \du #显示所有用户
postgres=# \dn #显示所有模式
postgres=# \dt #显示所有表
postgres=# \q #退出登录
举报

相关推荐

如何在 openGauss 中使用 zhparser

0 条评论