openGauss这么多工具?到底要选哪个?(16)

44 阅读1分钟

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/

任务示例

  1. 使用如下命令连接数据库。

    gsql -d postgres -p 15400
    

    postgres为需要连接的数据库名称,15400为数据库主节点的端口号。

    连接成功后,系统显示类似如下信息:

    gsql ((openGauss x.x build 290d125f) compiled at 2020-05-08 02:59:43 commit 2143 last mr 131
    Non-SSL connection (SSL connection is recommended when requiring high-security)
    Type "help" for help.
    
    openGauss=#
    
  2. 查看gsql的帮助信息。具体执行命令请参见表6 使用gsql联机帮助

    表 6 使用gsql联机帮助

    描述

    示例

    查看版权信息

    \copyright

    查看openGauss支持的SQL语句的帮助

    查看openGauss支持的SQL语句的帮助

    例如,查看openGauss支持的所有SQL语句:

    openGauss=# \h
    Available help:
      ABORT                            
      ALTER APP WORKLOAD GROUP                  
    ... ...
    

    例如,查看CREATE DATABASE命令的参数可使用下面的命令:

    openGauss=# \help CREATE DATABASE
    Command:     CREATE DATABASE
    Description: create a new database
    Syntax:
    CREATE DATABASE database_name
         [ [ WITH ] {[ OWNER [=] user_name ]|
               [ TEMPLATE [=] template ]|
               [ ENCODING [=] encoding ]|
               [ LC_COLLATE [=] lc_collate ]|
               [ LC_CTYPE [=] lc_ctype ]|
               [ DBCOMPATIBILITY [=] compatibility_type ]|
               [ TABLESPACE [=] tablespace_name ]|
               [ CONNECTION LIMIT [=] connlimit ]}[...] ];
    

    查看gsql命令的帮助

    例如,查看gsql支持的命令:

    openGauss=# \?
    General
      \copyright             show FusionInsight LibrA usage and distribution terms
      \g [FILE] or ;         execute query (and send results to file or |pipe)
      \h(\help) [NAME]              help on syntax of SQL commands, * for all commands
      \parallel [on [num]|off] toggle status of execute (currently off)
      \q                     quit gsql
    ... ...
    

#openGauss #入门 #安装 #数据库 #开源

知识来源:docs-opengauss.osinfra.cn/zh/