关键词搜索

源码搜索 ×
×

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

发布2021-06-12浏览2791次

详情内容

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

1、登录数据库

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

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

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
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64

1.5、查看数据库是否区分大小写

db1=> show case_sensitive;
 case_sensitive 
----------------
 off
(1 row)

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

这代表不区分大小写吧。默认情况下,人大进仓的数据库是区分大小写的,模式,用户名,全都自动转成大写,十分讨厌。

2、创建用户

db1=# create user zhyj password '密码';
  • 1

3、列出该数据库下的shema

db1=# \dn
  • 1

4、创建新的schema并指定新建的用户zhyj为owner

db1=# create schema zhyj authorization zhyj;
  • 1

5、设置新建用户zhyj的默认schema为新建的schema

db1=# alter user zhyj set search_path to zhyj;
  • 1

6、改用新建用户zhyj登录

db1=# \c db1 zhyj;
  • 1

7、登录进来,看看自己有啥表没有,不出所料,啥都没有。

db1=> \dt
No relations found.
  • 1
  • 2

相关技术文章

点击QQ咨询
开通会员
返回顶部
×
微信扫码支付
微信扫码支付
确定支付下载
请使用微信描二维码支付
×

提示信息

×

选择支付方式

  • 微信支付
  • 支付宝付款
确定支付下载