A password policy in MySQL is a set of rules that define the requirements for user passwords to improve security, such as minimum length, complexity, and expiration.
Click to reveal answer
beginner
Which MySQL system variable controls the password validation policy?
The validate_password.policy system variable controls the password validation policy in MySQL.
Click to reveal answer
intermediate
What are the possible values for validate_password.policy in MySQL?
Possible values are LOW, MEDIUM, and STRONG. Each level enforces different password complexity rules.
Click to reveal answer
intermediate
How can you set the minimum password length to 10 characters in MySQL?
Use the command: SET GLOBAL validate_password.length = 10; This sets the minimum password length to 10 characters.
Click to reveal answer
beginner
What happens if a password does not meet the current MySQL password policy?
MySQL will reject the password change or creation and return an error, forcing the user to choose a password that meets the policy requirements.
Click to reveal answer
Which MySQL plugin is commonly used to enforce password policies?
Avalidate_password
Baudit_log
Creplication
Dperformance_schema
✗ Incorrect
The validate_password plugin enforces password complexity and policy rules.
What does setting validate_password.policy to STRONG require?
AOnly minimum length
BLength, mixed case, numbers, and special characters
CNo restrictions
DOnly numbers
✗ Incorrect
STRONG policy requires passwords to have a minimum length and include uppercase, lowercase, numbers, and special characters.
How do you check the current password policy level in MySQL?
ADESCRIBE password_policy;
BSELECT * FROM users;
CSHOW VARIABLES LIKE 'validate_password.policy';
DSHOW STATUS;
✗ Incorrect
The command SHOW VARIABLES LIKE 'validate_password.policy'; shows the current password policy level.
If you want to disable password validation temporarily, what should you do?
ADROP USER 'root';
BSET GLOBAL validate_password.policy = LOW;
CSET GLOBAL validate_password.length = 0;
DUNINSTALL PLUGIN validate_password;
✗ Incorrect
Uninstalling the validate_password plugin disables password validation.
Which command sets the minimum number of special characters required in a password?
ASET GLOBAL validate_password.special_char_count = 2;
BSET GLOBAL validate_password.number_count = 2;
CSET GLOBAL validate_password.mixed_case_count = 2;
DSET GLOBAL validate_password.length = 2;
✗ Incorrect
The variable validate_password.special_char_count sets the minimum special characters required.
Explain how MySQL enforces password policies and how you can configure them.
Think about the plugin and system variables that control password rules.
You got /4 concepts.
Describe the steps to change the password policy to require at least 12 characters and 2 special characters.
Focus on system variables related to length and special characters.
You got /3 concepts.
Practice
(1/5)
1. What is the purpose of MySQL's validate_password_policy variable?
easy
A. To set rules for creating strong passwords
B. To control user access privileges
C. To define database storage engines
D. To manage query cache size
Solution
Step 1: Understand the variable name
The variable validate_password_policy relates to password validation rules.
Step 2: Identify its function
It sets rules to ensure passwords are strong and secure.
Final Answer:
To set rules for creating strong passwords -> Option A
Quick Check:
Password policy = Set rules for strong passwords [OK]
Hint: Policy variables control password strength rules [OK]
Common Mistakes:
Confusing password policy with user privileges
Thinking it manages database storage
Assuming it controls query cache
2. Which of the following is the correct syntax to check the current password policy level in MySQL?
easy
A. SHOW PASSWORD POLICY;
B. SELECT * FROM validate_password_policy;
C. SHOW VARIABLES LIKE 'validate_password_policy';
D. GET VARIABLES 'validate_password_policy';
Solution
Step 1: Recall how to view system variables
MySQL uses SHOW VARIABLES LIKE 'variable_name'; to display variable values.
Step 2: Match the variable name
The variable for password policy is validate_password_policy, so the correct syntax is SHOW VARIABLES LIKE 'validate_password_policy';
Final Answer:
SHOW VARIABLES LIKE 'validate_password_policy'; -> Option C
Quick Check:
SHOW VARIABLES LIKE 'validate_password_policy' [OK]
Hint: Use SHOW VARIABLES LIKE for system settings [OK]
Common Mistakes:
Using SELECT on a variable name
Trying non-existent commands like SHOW PASSWORD POLICY
Using GET VARIABLES which is invalid syntax
3. Given the following commands executed in MySQL:
SET GLOBAL validate_password_length = 10; SHOW VARIABLES LIKE 'validate_password_length';
What will be the output of the SHOW VARIABLES command?
medium
A. Variable_name: validate_password_length, Value: 10
B. Variable_name: validate_password_length, Value: 8
C. Syntax error
D. Variable_name: validate_password_policy, Value: 10
Solution
Step 1: Understand the SET GLOBAL command
The command sets the global password length requirement to 10 characters.
Step 2: SHOW VARIABLES output
The SHOW VARIABLES LIKE 'validate_password_length'; will display the current value, which is now 10.
Final Answer:
Variable_name: validate_password_length, Value: 10 -> Option A
Quick Check:
SET GLOBAL changes variable, SHOW displays updated value [OK]
Hint: SET GLOBAL changes variable, SHOW displays current value [OK]
Common Mistakes:
Expecting default value instead of updated
Confusing variable names
Assuming syntax error from SET GLOBAL
4. You tried to set the password policy level with this command:
SET GLOBAL validate_password_policy = 'STRONG';
But MySQL returned an error. What is the likely cause?
medium
A. The command requires quotes around the variable name
B. The variable name is incorrect
C. You must use SET SESSION instead of SET GLOBAL
D. The value should be an integer, not a string
Solution
Step 1: Check variable type for validate_password_policy
This variable expects an integer value (0,1,2) representing policy levels, not strings.
Step 2: Understand error cause
Using a string like 'STRONG' causes a type mismatch error.
Final Answer:
The value should be an integer, not a string -> Option D
Quick Check:
Policy level = integer, not string [OK]
Hint: Policy levels use numbers, not words [OK]
Common Mistakes:
Using string values instead of integers
Mistyping variable name
Confusing SET GLOBAL with SET SESSION
5. You want to enforce a password policy that requires passwords to be at least 12 characters long, include mixed case letters, numbers, and special characters. Which combination of MySQL variables should you set to achieve this?
hard
A. SET GLOBAL validate_password_length = 10; SET GLOBAL validate_password_policy = 0;
B. SET GLOBAL validate_password_length = 12; SET GLOBAL validate_password_policy = 2;
C. SET GLOBAL validate_password_length = 12; SET GLOBAL validate_password_policy = 1;
D. SET GLOBAL validate_password_length = 8; SET GLOBAL validate_password_policy = 0;
Solution
Step 1: Understand password length requirement
You want at least 12 characters, so validate_password_length must be set to 12.
Step 2: Understand policy levels
Policy level 2 (STRONG) requires mixed case, numbers, and special characters.
Step 3: Match variables to requirements
Setting validate_password_policy = 2 and length to 12 enforces all requirements.
Final Answer:
SET GLOBAL validate_password_length = 12; SET GLOBAL validate_password_policy = 2; -> Option B