文章目录

  • 一、前文
  • 二、查看用户
  • 三、创建用户
  • 四、修改用户
  • 五、用户登录
  • 六、删除用户
  • 七、权限管理


一、前文

TDengine 入门教程——导读

二、查看用户

SHOW USERS;

  • super
  • 1,表示超级用户权限
  • 0,表示普通用户权限
  • enable
  • 1,表示启用此用户
  • 0,表示禁用此用户
  • sysinfo
  • 1,表示可以查看系统信息(服务端配置信息、服务端各种节点信息(如 DNODE、QNODE等)、存储相关的信息)
  • 0,表示不可以查看
taos> SHOW USERS;
           name           | super | enable | sysinfo |       create_time       |
================================================================================
 root                     |     1 |      1 |       1 | 2022-09-07 11:09:05.717 |
Query OK, 1 rows in database (0.002492s)

三、创建用户

CREATE USER weijian PASS ‘123456’ SYSINFO 1;

taos> CREATE USER weijian PASS '123456' SYSINFO 1;
Query OK, 0 of 0 rows affected (0.000644s)

taos> SHOW USERS;
           name           | super | enable | sysinfo |       create_time       |
================================================================================
 weijian                  |     0 |      1 |       1 | 2022-09-08 15:45:43.188 |
 root                     |     1 |      1 |       1 | 2022-09-07 11:09:05.717 |
Query OK, 2 rows in database (0.004649s)

四、修改用户

ALTER USER weijian PASS ‘456789’;

ALTER USER weijian ENABLE 0;

ALTER USER weijian SYSINFO 0;

taos> ALTER USER weijian PASS '456789';
Query OK, 0 of 0 rows affected (0.000591s)

taos> ALTER USER weijian ENABLE 0;
Query OK, 0 of 0 rows affected (0.003619s)

taos> ALTER USER weijian SYSINFO 0;
Query OK, 0 of 0 rows affected (0.003626s)

taos> SHOW USERS;
           name           | super | enable | sysinfo |       create_time       |
================================================================================
 weijian                  |     0 |      0 |       0 | 2022-09-08 15:45:43.188 |
 root                     |     1 |      1 |       1 | 2022-09-07 11:09:05.717 |
Query OK, 2 rows in database (0.003528s)

taos> 
taos> exit

五、用户登录

  • -u 指定用户,否则默认登录root

taos -u weijian -p

taos -p

[root@iZ2ze30dygwd6yh7gu6lskZ ~]# taos -u weijian -p
Enter password: Welcome to the TDengine Command Line Interface, Client Version:3.0.0.1
Copyright (c) 2022 by TDengine, all rights reserved.

Server is Community Edition.

taos> exit
[root@iZ2ze30dygwd6yh7gu6lskZ ~]# taos -p
Enter password: Welcome to the TDengine Command Line Interface, Client Version:3.0.0.1
Copyright (c) 2022 by TDengine, all rights reserved.

Server is Community Edition.

taos> exit

六、删除用户

DROP USER weijian;

taos> DROP USER weijian;
Query OK, 0 of 0 rows affected (0.000756s)

taos> SHOW USERS;
           name           | super | enable | sysinfo |       create_time       |
================================================================================
 root                     |     1 |      1 |       1 | 2022-09-07 11:09:05.717 |
Query OK, 1 rows in database (0.001342s)

七、权限管理

  • 授权

GRANT ALL ON test.* TO weijian;

  • 撤销授权

REVOKE WRITE ON test.* FROM weijian;

taos> GRANT ALL ON test.* TO weijian;
Query OK, 0 of 0 rows affected (0.000712s)

taos> REVOKE WRITE ON test.* FROM weijian;
Query OK, 0 of 0 rows affected (0.000622s)