GBase 8c
运维管理
文章

GBase 8c gsql使用帮助

GBase社区管理员
发表于2024-02-04 17:09:4746次浏览0个评论
  • 连接数据库时,可以使用如下命令获取帮助信息。

[gbase@gbasehost ~]$ gsql --help

显示如下帮助信息:

Usage:
gsql [OPTION]... [DBNAME [USERNAME]]

General options:
-c, --command=COMMANDrun only single command (SQL or internal) and exit
-d, --dbname=DBNAMEdatabase name to connect to (default: "gbase")
-f, --file=FILENAMEexecute commands from file, then exit
-l, --listlist available databases, then exit
-v, --set=, --variable=NAME=VALUE
set gsql variable NAME to VALUE
-V, --versionoutput version information, then exit
-X, --no-gsqlrcdo not read startup file (~/.gsqlrc)
-1 ("one"), --single-transaction
execute command file as a single transaction
-?, --helpshow this help, then exit

Input and output options:
-a, --echo-allecho all input from script
-e, --echo-queriesecho commands sent to server
-E, --echo-hiddendisplay queries that internal commands generate
-k, --with-key=KEYthe key for decrypting the encrypted file
-L, --log-file=FILENAMEsend session log to file
-m, --maintenancecan connect to cluster during 2-pc transaction recovery
-n, --no-libeditdisable enhanced command line editing (libedit)
-o, --output=FILENAMEsend query results to file (or |pipe)
-q, --quietrun quietly (no messages, only query output)
-C, --enable-client-encryptionenable client encryption feature
-s, --single-stepsingle-step mode (confirm each query)
-S, --single-linesingle-line mode (end of line terminates SQL command)

Output format options:
-A, --no-alignunaligned table output mode
-F, --field-separator=STRING
set field separator (default: "|")
-H, --htmlHTML table output mode
-P, --pset=VAR[=ARG]set printing option VAR to ARG (see \pset command)
-R, --record-separator=STRING
set record separator (default: newline)
-rif this parameter is set,use libedit
-t, --tuples-onlyprint rows only
-T, --table-attr=TEXTset HTML table tag attributes (e.g., width, border)
-x, --expandedturn on expanded table output
-z, --field-separator-zero
set field separator to zero byte
-0, --record-separator-zero
set record separator to zero byte
-2, --pipelineuse pipeline to pass the password, forbidden to use in terminal
must use with -c or -f

Connection options:
-h, --host=HOSTNAMEdatabase server host or socket directory (default: "/home/gbase/gbase_db/tmp")
-p, --port=PORTdatabase server port (default: "5432")
-U, --username=USERNAMEdatabase user name (default: "gbase")
-W, --password=PASSWORDthe password of specified database user

For more information, type "\?" (for internal commands) or "\help" (for SQL
commands) from within gsql, or consult the gsql section in the GaussDB Kernel
documentation.
  • 连接到数据库后,可以使用如下命令获取帮助信息。

postgres=# help

显示如下帮助信息:

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
评论已关闭