HomeMogDBMogDB StackUqbar
v3.1

Documentation:v3.1

Supported Versions:

Other Versions:

Obtaining Help Information

Procedure

  • After connecting to the database, run the following command to obtain the help information:

    gsql --help

    The following help information is displayed:

    ......
    Usage:
      gsql [OPTION]... [DBNAME [USERNAME]]
    
    General options:
      -c, --command=COMMAND    run only single command (SQL or internal) and exit
      -d, --dbname=DBNAME      database name to connect to (default: "omm")
      -f, --file=FILENAME      execute commands from file, then exit
    ......
  • After connecting to the database, run the following command to obtain the help information:

    help

    The following help information is displayed:

    You are using gsql, the command-line interface to gaussdb.
    Type:  \copyright for distribution terms
           \h for help with SQL commands
           \? for help with gsql commands
           \g or terminate with semicolon to execute query
           \q to quit

Examples

  1. Run the following command to connect to the database:

    gsql -d mogdb -p 15400

    mogdb is the name of the database to be connected, and 15400 is the port number of the primary database node.

    If information similar to the following is displayed, the connection succeeds:

    gsql ((MogDB x.x.x build 56189e20) compiled at 2022-01-07 18:47:53 commit 0 last mr  )
    Non-SSL connection (SSL connection is recommended when requiring high-security)
    Type "help" for help.
    
    mogdb=#
  2. View the gsql help information. For details, see Table gsql online help.

    Table 6 gsql online help

    Description Example
    Query the copyright. \copyright
    View SQL statements supported by MogDB. View SQL statements supported by MogDB.
    To query all SQL statements supported by MogDB, run the following command:
    mogdb=# \h
    Available help:
    ABORT
    ALTER APP WORKLOAD GROUP
    … …
    For example, view parameters of the CREATE DATABASE command:
    mogdb=# \help CREATE DATABASE
    Command: CREATE DATABASE
    Description: create a new database
    Syntax:
    CREATE DATABASE database_name
    `[ [ WITH ] {[ OWNER [=] user_name ]
    View the help information about gsql commands. For example, view commands supported by gsql.
    mogdb=# \?
    General
    \copyright show FusionInsight LibrA usage and distribution terms
    `\g [FILE] or ; execute query (and send results to file or
Copyright © 2011-2024 www.enmotech.com All rights reserved.