×
Community Blog Database Security - How to Implement Password Policy on MySQL Databases Using validate_password

Database Security - How to Implement Password Policy on MySQL Databases Using validate_password

In this video tutorial, we will show you how 'validate_password' can help you apply strong password to your database.

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:

  1. How to install
  2. How to see its default settings
  3. 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';
0 1 0
Share on

ApsaraDB

459 posts | 98 followers

You may also like

Comments

ApsaraDB

459 posts | 98 followers

Related Products