统信下人大金仓终端创建schema和用户
Posted 左直拳
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了统信下人大金仓终端创建schema和用户相关的知识,希望对你有一定的参考价值。
一定要用终端,命令行的方式才够酷。
1、登录数据库
chenqu@chenqu-uos:~$ ksql -h 192.168.0.202 -U system -W 密码 数据库名称
如果不记得命令,可以查看帮助
chenqu@chenqu-uos:~$ ksql --help
ksql is the Kingbase interactive terminal.
Usage:
ksql [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: "chenqu")
-f, --file=FILENAME execute commands from file, then exit
-l, --list list available databases, then exit
-v, --set=, --variable=NAME=VALUE
set ksql variable NAME to VALUE
(e.g., -v ON_ERROR_STOP=1)
-V, --version output version information, then exit
-X, --no-ksqlrc do not read startup file (~/.ksqlrc)
-1 ("one"), --single-transaction
execute as a single transaction (if non-interactive)
-?, --help[=options] show this help, then exit
--help=commands list backslash commands, then exit
--help=variables list special variables, then exit
Input and output options:
-a, --echo-all echo all input from script
-b, --echo-errors echo failed commands
-e, --echo-queries echo commands sent to server
-E, --echo-hidden display queries that internal commands generate
-L, --log-file=FILENAME send session log to file
-n, --no-readline disable enhanced command line editing (readline)
-o, --output=FILENAME send query results to file (or |pipe)
-q, --quiet run quietly (no messages, only query output)
-s, --single-step single-step mode (confirm each query)
-S, --single-line single-line mode (end of line terminates SQL command)
Output format options:
-A, --no-align unaligned table output mode
-F, --field-separator=STRING
field separator for unaligned output (default: "|")
-H, --html HTML table output mode
-P, --pset=VAR[=ARG] set printing option VAR to ARG (see \\pset command)
-R, --record-separator=STRING
record separator for unaligned output (default: newline)
-t, --tuples-only print rows only
-T, --table-attr=TEXT set HTML table tag attributes (e.g., width, border)
-x, --expanded turn on expanded table output
-z, --field-separator-zero
set field separator for unaligned output to zero byte
-0, --record-separator-zero
set record separator for unaligned output to zero byte
Connection options:
-h, --host=HOSTNAME database server host or socket directory (default: "local socket")
-p, --port=PORT database server port (default: "54321")
-U, --username=USERNAME database user name (default: "chenqu")
-w, --no-password never prompt for password
-W, --password password
-O, --nonempty-password password with not empty
For more information, type "\\?" (for internal commands) or "\\help" (for SQL
commands) from within ksql, or consult the ksql section in the Kingbase
documentation.
Report bugs to <kingbase-bugs@kingbase.com.cn>.
1.5、查看数据库是否区分大小写
db1=> show case_sensitive;
case_sensitive
----------------
off
(1 row)
这代表不区分大小写吧。默认情况下,人大进仓的数据库是区分大小写的,模式,用户名,全都自动转成大写,十分讨厌。
2、创建用户
db1=# create user zhyj password '密码';
3、列出该数据库下的shema
db1=# \\dn
4、创建新的schema并指定新建的用户zhyj为owner
db1=# create schema zhyj authorization zhyj;
5、设置新建用户zhyj的默认schema为新建的schema
db1=# alter user zhyj set search_path to zhyj;
6、改用新建用户zhyj登录
db1=# \\c db1 zhyj;
7、登录进来,看看自己有啥表没有,不出所料,啥都没有。
db1=> \\dt
No relations found.
以上是关于统信下人大金仓终端创建schema和用户的主要内容,如果未能解决你的问题,请参考以下文章