How Do I Configure a Password Expiration Policy for RDS for MySQL DB Instances?
In MySQL 5.6, you can run ALTER USER *** PASSWORD EXPIRE to set the password expiration policy.
In MySQL 5.7 and 8.0, you can set the global variable default_password_lifetime to control the default validity period of a user password.
The value of default_password_lifetime indicates how many days until a password expires. The default value is 0, indicating that the created user password will never expire.
Changing the Global Automatic Password Expiration Policy
Change the value of the default_password_lifetime parameter on the RDS console. For operation details, see Modifying Parameters.
Checking the Password Expiration Date of All Users
Run the following command:
mysql> select user,host,password_expired,password_last_changed,password_lifetime from user;
Checking the Password Expiration Policy of a Specified User
Run the following command:
mysql> show create user jeffrey@'localhost';
EXPIRE DEFAULT indicates that the password follows the global expiration policy.
Configuring the Password Expiration Policy for a Specified User
- Configuring the password expiration policy during user creation
create user 'script'@'localhost' identified by '*********' password expire interval 90 day;
- Configuring the password expiration policy after user creation
ALTER USER 'script'@'localhost' PASSWORD EXPIRE INTERVAL 90 DAY;
- Setting the password to be permanently valid
CREATE USER 'mike'@'%' PASSWORD EXPIRE NEVER;
ALTER USER 'mike'@'%' PASSWORD EXPIRE NEVER;
- Setting the password to follow the global expiration policy
CREATE USER 'mike'@'%' PASSWORD EXPIRE DEFAULT;
ALTER USER 'mike'@'%' PASSWORD EXPIRE DEFAULT;
Database Parameter Modification FAQs
- What Inappropriate Parameter Settings Cause Unavailability of the RDS for PostgreSQL Database?
- How Can I Change the Time Zone?
- How Do I Configure a Password Expiration Policy for RDS for MySQL DB Instances?
- How Do I Change the Transaction Isolation Level of an RDS for MySQL Instance?
- How Do I Ensure that the Character Set of an RDS MySQL Database Is Correct?
- Does RDS for PostgreSQL Support the test_decoding Plugin?
- How Do I Use the utf8mb4 Character Set to Store Emojis in an RDS for MySQL DB Instance?
- Where Should I Store NDF Files for RDS for SQL Server?
- Can I Use SQL Commands to Modify Global Parameters?
- How Do I Modify the Collation of RDS for SQL Server?
- How Do I Set Case Sensitivity for RDS for MySQL Table Names?
- Can I Enable Query Caching for My RDS for MySQL Instance?
- Can I Modify the temp_file_limit Parameter for My RDS for PostgreSQL Instance?
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbotmore