0
0
MySQLquery~20 mins

Password policies in MySQL - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Password Policy Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
query_result
intermediate
2:00remaining
Check password expiration setting
What is the output of the following query that checks the global password expiration policy in MySQL?
MySQL
SHOW VARIABLES LIKE 'default_password_lifetime';
A[{"Variable_name": "default_password_lifetime", "Value": "90"}]
B[{"Variable_name": "default_password_lifetime", "Value": "0"}]
C[{"Variable_name": "default_password_lifetime", "Value": "180"}]
D[{"Variable_name": "default_password_lifetime", "Value": "30"}]
Attempts:
2 left
💡 Hint
The default value 0 means passwords never expire unless changed.
📝 Syntax
intermediate
2:00remaining
Identify the correct syntax to enforce password expiration
Which option correctly sets the password expiration policy to 60 days for all users in MySQL?
AALTER USER ALL PASSWORD EXPIRE INTERVAL 60 DAY;
BSET PASSWORD EXPIRE INTERVAL 60 DAY FOR ALL;
CSET GLOBAL default_password_lifetime = 60;
DALTER GLOBAL PASSWORD LIFETIME 60 DAYS;
Attempts:
2 left
💡 Hint
The setting is a global variable, not a user-level command.
🧠 Conceptual
advanced
2:00remaining
Understanding password validation plugin
Which statement best describes the role of the MySQL validate_password plugin?
AIt manages user account lockout after failed login attempts.
BIt automatically expires passwords after a set number of days.
CIt encrypts passwords stored in the database.
DIt enforces password strength rules like length and character types during password changes.
Attempts:
2 left
💡 Hint
Think about what controls password complexity requirements.
🔧 Debug
advanced
2:00remaining
Why does this password expiration command fail?
A DBA runs this command to expire a user's password immediately but gets an error:

ALTER USER 'alice'@'localhost' PASSWORD EXPIRE INTERVAL 0 DAY;

What is the reason for the failure?
AThe INTERVAL value cannot be zero; use PASSWORD EXPIRE without INTERVAL to expire immediately.
BThe user 'alice' does not exist in the database.
CThe syntax requires the keyword 'SET' before PASSWORD EXPIRE.
DPassword expiration cannot be set per user in MySQL.
Attempts:
2 left
💡 Hint
Check the correct syntax for immediate password expiration.
optimization
expert
3:00remaining
Optimize password policy enforcement for many users
You want to enforce a strong password policy and expiration for thousands of users efficiently. Which approach is best?
ASet global variables <code>default_password_lifetime</code> and enable <code>validate_password</code> plugin once, so all users inherit policies automatically.
BManually run <code>ALTER USER ... PASSWORD EXPIRE</code> and password validation for each user individually.
CCreate a trigger on the user table to check password strength and expiration on every login.
DDisable password expiration and rely on users to change passwords voluntarily.
Attempts:
2 left
💡 Hint
Think about scalability and central management.