复古 护眼 海天 深邃 暗黑 默认

SHOW MASK RULES

描述

SHOW MASK RULES 语法用于查询指定逻辑库中的数据脱敏规则。

语法

ShowMaskRule::=
  'SHOW' 'MASK' ('RULES' | 'RULE' ruleName) ('FROM' databaseName)?

ruleName ::=
  identifier

databaseName ::=
  identifier

补充说明

  • 未指定 databaseName 时,默认是当前使用的 DATABASE, 如果也未使用 DATABASE 则会提示 No database selected

返回值说明

说明
table 表名
column 列名
algorithm_type 数据脱敏算法类型
algorithm_props 数据脱敏算法参数

示例

  • 查询指定逻辑库中的所有数据脱敏规则
SHOW MASK RULES FROM mask_db;
mysql> SHOW MASK RULES FROM mask_db;
+---------+----------+------------------+--------------------------------+
| table   | column   | algorithm_type   | algorithm_props                |
+---------+----------+------------------+--------------------------------+
| t_mask  | phoneNum | MASK_FROM_X_TO_Y | to-y=2,replace-char=*,from-x=1 |
| t_mask  | address  | MD5              |                                |
| t_order | order_id | MD5              |                                |
| t_user  | user_id  | MASK_FROM_X_TO_Y | to-y=2,replace-char=*,from-x=1 |
+---------+----------+------------------+--------------------------------+
4 rows in set (0.01 sec)
  • 查询当前逻辑库中的所有数据脱敏规则
SHOW MASK RULES;
mysql> SHOW MASK RULES;
+---------+----------+------------------+--------------------------------+
| table   | column   | algorithm_type   | algorithm_props                |
+---------+----------+------------------+--------------------------------+
| t_mask  | phoneNum | MASK_FROM_X_TO_Y | to-y=2,replace-char=*,from-x=1 |
| t_mask  | address  | MD5              |                                |
| t_order | order_id | MD5              |                                |
| t_user  | user_id  | MASK_FROM_X_TO_Y | to-y=2,replace-char=*,from-x=1 |
+---------+----------+------------------+--------------------------------+
4 rows in set (0.01 sec)
  • 查询指定逻辑库中的指定数据脱敏算法
SHOW MASK RULE t_mask FROM mask_db;
mysql> SHOW MASK RULE t_mask FROM mask_db;
+--------+--------------+------------------+--------------------------------+
| table  | logic_column | mask_algorithm   | props                          |
+--------+--------------+------------------+--------------------------------+
| t_mask | phoneNum     | MASK_FROM_X_TO_Y | to-y=2,replace-char=*,from-x=1 |
| t_mask | address      | MD5              |                                |
+--------+--------------+------------------+--------------------------------+
2 rows in set (0.00 sec)
  • 查询当前逻辑库中的指定数据脱敏算法
SHOW MASK RULE t_mask;
mysql> SHOW MASK RULE t_mask;
+--------+--------------+------------------+--------------------------------+
| table  | logic_column | mask_algorithm   | props                          |
+--------+--------------+------------------+--------------------------------+
| t_mask | phoneNum     | MASK_FROM_X_TO_Y | to-y=2,replace-char=*,from-x=1 |
| t_mask | address      | MD5              |                                |
+--------+--------------+------------------+--------------------------------+
2 rows in set (0.00 sec)

保留字

SHOWMASKRULERULESFROM

相关链接