Database Security - How to Implement Password Policy on MySQL Databases Using validate_password
Are you the one who use weak password like 'admin', '123456' sort of things? How to set up a password policy to prevent human factors caused by lack of the sense of data security from the very beginning? If you are using MySQL, this is the thing you shouldn’t miss.
You will learn:
- How to install
- How to see its default settings
- How to uninstall
For more information, please refer to the MySQL official documentation or you can also find the guidance on Alibaba Cloud.
https://dev.mysql.com/doc/refman/8.0/en/validate-password.html
https://www.alibabacloud.com/help/en/apsaradb-for-rds/latest/configure-a-custom-password-policy-for-an-apsaradb-rds-for-mysql-instance
Quick Start
Mysql 5.7
// weak password
create user test identified by 'admin';
Drop user test;
//check if validate_password is installed?
SELECT PLUGIN_NAME, PLUGIN_LIBRARY, PLUGIN_STATUS, LOAD_OPTION
FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME = 'validate_password';
// install plugin
INSTALL PLUGIN validate_password SONAME 'validate_password.so';
// check status
select * from mysql.plugin;
SHOW GLOBAL VARIABLES LIKE 'validate_password%';
// test
create user test identified by '123456';
create user test identified by 'Passw@rd1';
drop user test;
//change variables
SET GLOBAL validate_password_policy=LOW;
//uninstall
UNINSTALL PLUGIN validate_password;
MySQL 8.0
// weak password
create user test identified by 'administrator';
Drop user test;
// check if installed?
SELECT * FROM mysql.component;
// install the component
INSTALL COMPONENT 'file://component_validate_password';
// see system variables
show variables like 'validate_password%';
SHOW STATUS LIKE 'validate_password%';
// test
create user test identified by '123456';
create user test identified by 'Passw@rd1';
drop user test;
// change the variables
SET GLOBAL validate_password_policy=STRONG;
// uninstall
UNINSTALL COMPONENT 'file://component_validate_password';
Read previous post:
Read next post:
Database Security - How to Realize Data Masking in Data Management Service on Alibaba Cloud
Comments
Related Products
-
Security Center
A unified security management system that identifies, analyzes, and notifies you of security threats in real time
Learn More -
Database Security Solutions
Protect, backup, and restore your data assets on the cloud with Alibaba Cloud database services.
Learn More -
Data Security Center (Original SDDP)
An all-in-one data security solution that provides various features, such as sensitive data detection, classification, grading, and de-identification, to help you meet compliance requirements specified in General Data Protection Regulation (GDPR) and personal information protection
Learn More -
PolarDB for MySQL
Alibaba Cloud PolarDB for MySQL is a cloud-native relational database service 100% compatible with MySQL.
Learn More
More Posts by ApsaraDB
- With PostgreSQL Firmly in Place as the Data Foundation, What Else Do Agents Need to Truly Run?
- The 6 Components of RAG, Actually Just Need 1 Database
- PolarDB-X Zero: Get an AI-Friendly Database in 30 Seconds with a Single Command
- HiCache Across Multi‑Parallelism and Distributed Serving
- How CXL 2.0 Drives the Evolution of PolarDB's Software-Hardware Co-Designed Architecture
- CloudJump III: Optimizing Cloud Databases for Tiered Storage (SIGMOD 2026)
- Highlights | Alibaba Cloud Database New Features in September 2026
- [Infographic] Highlights | Database New Features in August 2026
- The First Data Foundation of the Agent Era: What Exactly Is the PolarDB Full-Stack Data Foundation for Agents?
- MemOS × PolarDB All-in-One Memory Management Solution: Giving AI Unbroken Memory