统信下人大金仓终端创建schema和用户

网友投稿 653 2022-08-22

统信下人大金仓终端创建schema和用户

一定要用终端,命令行的方式才够酷。

1、登录数据库

chenqu@chenqu-uos:~$ ksql -h 192.168.0.202 -U system -W 密码 数据库名称

如果不记得命令,可以查看帮助

chenqu@chenqu-uos:~$ ksql --helpksql 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 exitInput 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 byteConnection 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 emptyFor more information, type "\?" (for internal commands) or "\help" (for SQLcommands) from within ksql, or consult the ksql section in the Kingbasedocumentation.Report bugs to .

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=> \dtNo relations found.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Python之懒惰属性(延迟初始化)
下一篇:将pg的表复制到人大金仓
相关文章

 发表评论

暂时没有评论,来抢沙发吧~