GBase 8a 查看数据库用户和密码

GBase 8a数据库集群,可以通过current_user查看当前登录的用户,而密码是加密的,无法看到原文。最新版的GBase8a的用户密码是支持sha256加密。

查看当前登录用户 current_user

gbase> select current_user();
+----------------+
| current_user() |
+----------------+
| root@%         |
+----------------+
1 row in set (Elapsed: 00:00:00.00)

查看其它登录信息 show login status

gbase> show login status;
+------+------------+------------+-----------------+-----------------+------------+-----------------------+
| USER | LOGIN_TIME | LOGIN_HOST | LAST_LOGIN_TIME | LAST_LOGIN_HOST | LAST_RETRY | VALID_PASSWORD_EXPIRE |
+------+------------+------------+-----------------+-----------------+------------+-----------------------+
| root | NULL       |            | NULL            |                 |          0 | NEVER                 |
+------+------------+------------+-----------------+-----------------+------------+-----------------------+
1 row in set (Elapsed: 00:00:00.00)

当前连接状态 status

参考 GBase 8a的status命令显示当前连接状态信息

gbase> status;
--------------
gccli ver 8.6.2.43-R28 .125499, for unknown-linux-gnu (x86_64) using readline 6.3

Connection id:          217
Current database:       testdb
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         8.6.2.43-R28 .125499
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /tmp/gcluster_5258.sock
Uptime:                 Elapsed: 30:50:11.00

Threads: 3  Questions: 382  Slow queries: 0  Opens: 127  Flush tables: 1  Open tables: 28  Queries per second avg: 0.3
--------------

查看密码

如果你是管理员,或者有权限查看,那么如下这个表是保存用户名和密码的元数据表。其中Password字段是密码,为加密保存的。

GBase 8a数据库用户元数据表gbase.user查看