ApsaraDB for MyBase lets you set a custom password policy to enhance database security.
Prerequisites
-
The instance runs MySQL 5.7 High-availability Edition.
-
The instance runs the latest minor engine version.
Overview
For MySQL 5.7 instances, you can use the validate_password plugin to configure password complexity rules for database accounts:
-
Whether the password can be the same as the username.
-
Required password length.
-
Required number of uppercase and lowercase letters.
-
Required number of digits.
-
Required number of special characters.
-
Password strength level.
Step 1: Install the validate_password plugin
-
Connect to a MyBase for MySQL instance.
NoteYou must connect to the MySQL instance using a privileged account. For more information, see Create a database account.
-
In your SQL client, run the following command to install the
validate_passwordplugin.INSTALL PLUGIN validate_password SONAME 'validate_password.so'; -
Run the following command to verify that the plugin is installed.
SHOW GLOBAL VARIABLES LIKE 'validate_password%';After you run the command, the command returns a list of
validate_passwordsystem variables and their current values. The plugin is installed successfully if the output shows default values, such asvalidate_password_dictionary_filebeing empty,validate_password_lengthas8,validate_password_mixed_case_countas1,validate_password_number_countas1,validate_password_policyasMEDIUM, andvalidate_password_special_char_countas1.
Step 2: Configure password policy parameters
-
Log on to the ApsaraDB for MyBase console.
-
In the upper-left corner of the page, select a region.
-
In the left-side navigation pane, choose .
-
Find your target instance, click Details in the Actions column, and then click Parameters in the left-side navigation pane.
-
Configure the loose_validate_password parameters. The parameters are described as follows.
NoteBefore you modify the following parameters, you must complete Step 1: Install the validate_password plugin. Otherwise, your changes will not take effect.
Parameter
Description
loose_validate_password_check_user_name
Determines if a password can be the same as the username. Valid values:
-
ON: Allowed.
-
OFF: Not allowed.
Default: OFF.
validate_password_policy
The password strength level. Valid values:
-
0 (LOW): Checks only the password length.
-
1 (MEDIUM): Checks the password length, number of digits, number of uppercase and lowercase letters, and number of special characters.
-
2 (STRONG): Checks all criteria for the MEDIUM level and also checks against a dictionary file.
NoteYou cannot specify a dictionary file. Therefore, strength levels 1 and 2 are equivalent.
Default: 1.
validate_password_length
The minimum password length. Valid values: 0 to 256.
Default: 8.
validate_password_number_count
The minimum number of digits required in a password. Valid values: 0 to 256.
Default: 1.
validate_password_mixed_case_count
The minimum number of uppercase and lowercase letters required in a password. Valid values: 0 to 256.
Default: 1.
validate_password_special_char_count
The minimum number of special characters required in a password. Valid values: 0 to 256.
Default: 1.
Note-
For instructions on creating an account, see Create a database account.
-
For more details on password settings, consult the official MySQL documentation.
-