Help Center/ Relational Database Service_RDS for MySQL/ User Guide/ Security and Encryption/ Configuring Dynamic Data Masking for an RDS for MySQL Instance
Updated on 2025-08-20 GMT+08:00

Configuring Dynamic Data Masking for an RDS for MySQL Instance

Function

Dynamic data masking is a security technology that masks data when databases send data to clients. RDS for MySQL allows you to add masking rules to mask data in specified databases, tables, and columns.

Figure 1 Topology

If dynamic data masking is enabled and a full-field masking rule (add_mask_rule('', '', '', '')) is configured, the database performance loss is within 5% under the following conditions when sysbench is used to perform a stress test: There are 128 tables each with 25,000 rows of data imported to the instance, and the QPS is about 400,000.

QPS stands for queries per second.

Supported Versions

To use this function, the kernel version of your instance must be 8.0.32.250300 or later.

Constraints

  • This function can take effect only for SELECT statements.
  • The masking rules are not applied to system databases. System databases include mysql, information_schema, performance_schema, and sys.
  • Spaces and special null characters (such as '\t', '\r', and '\n') at the beginning and end of a database name, table name, column name, or username will be ignored.
  • A database name, table name, or column name should be no longer than 64 bytes. A username should be no longer than 32 bytes.
  • The administrator list (the value of rds_dynamic_masking_super_users) should be no longer than 1,024 bytes.
  • The masking method varies depending on the data type. For details, see Table 1.
    Table 1 Data masking

    Data Type

    After Masking

    Integer (TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT, and BOOLEAN)

    A positive integer

    Decimal (DECIMAL, FLOAT, and DOUBLE)

    Time (YEAR)

    Time (DATE, TIME, DATETIME, and TIMESTAMP)

    DATE: [1000:01:01,9999:12:31.499999]

    TIME: [00:00:00,838:59:59.499999]

    DATETIME and TIMESTAMP: [1971:01:01 00:00:00, 2037:12:31 23:59:59.49999]

    String

    ******

Parameters for Dynamic Data Masking

Table 2 Parameter description

Parameter

Level

Description

rds_dynamic_masking_enabled

Global

Whether to enable dynamic data masking. The default value is OFF.

rds_dynamic_masking_super_users

Global

Multiple administrator accounts can be configured. The default value is an empty string ('').

Use commas (,) to separate administrator accounts. The masking rules do not take effect for administrators. Example: 'user1,user2'

rds_masking_paramter_max_count

Global

The maximum number of database names, table names, column names, or usernames that can be configured. Default value: 100; value range: [1, 1000]

Usage