• TDengine 入门教程④——权限管理 | 用户增删改查,授权与撤销授权


    一、前文

    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)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    三、创建用户

    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)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10

    四、修改用户

    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
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19

    五、用户登录

    • -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
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    六、删除用户

    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)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    七、权限管理

    • 授权

    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)
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    觉得好,就一键三连呗(点赞+收藏+关注)

  • 相关阅读:
    神经网络 06(优化方法)
    5个常用的CMD命令
    【机翻】RTnet – 灵活的硬实时网络框架
    Codeforces Round 904 (Div. 2) C
    从零开始运行YOLOV5
    凯撒密码-加密
    Kafka (二) ---------- Kafka 快速入门
    【POJ No. 1442】 黑盒子 Black Box
    STM32 HAL库F103系列之DAC实验(一)
    前端求职指南
  • 原文地址:https://blog.csdn.net/kangweijian/article/details/126748284