- Changing the "root" User Password
- Use the following command at the MySQL command prompt (after logging in to MySQL) to change the "root" user password on MySQL 5.7.6 or later:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'mYub3rS3cuUr$p@sswRD';
- Checking the MySQL Password Validation Level
The MySQL Password Validation Plugin is used to validate that any MySQL user passwords are of acceptable strength. The MySQL Reference Manual and specifically the Password Validation Options and Variables section provides more detailed information about password policy validation.
For production servers, it is recommended that at least the "MEDIUM" password policy validation level be enforced.
Note that on Red Hat Enterprise Linux, it is set to the "MEDIUM" password policy by default. This means all MySQL user passwords must contain at least one uppercase letter, at least one lowercase letter, at least one number, at least one special character, and be at least eight characters long.
Use the following command at the MySQL command prompt (after logging in to MySQL) to return the currently set password policy validation level and requirements:
SHOW VARIABLES LIKE 'validate_password%';