1Z0-888 · Question #47
You have created a new user with this statement: CREATE USER 'erika'@'localhost' IDENTIFIED BY 'first#1Pass' PASSWORD EXPIRE; What is the outcome?
The correct answer is C. When 'erika'@'localhost' tries to log in with the MySQL command-line client, the user will be permitted to log in but will not be able to issue any statements until the user changes the password. When PASSWORD EXPIRE is used in CREATE USER, MySQL allows the user to connect successfully but places the session into sandbox mode - the user reaches the mysql> prompt but every SQL statement they attempt returns an error instructing them to change their password first (via…
Question
CREATE USER 'erika'@'localhost' IDENTIFIED BY 'first#1Pass' PASSWORD EXPIRE;
What is the outcome?Options
- AWhen 'erika'@'localhost' tries to log in with the MySQL command-line client, the user will have to change the password before seeing the MySQL> prompt.
- BWhen 'erika'@'localhost' tries to log in with the MySQL command-line client, the user will not be permitted to log in because the password is expired.
- CWhen 'erika'@'localhost' tries to log in with the MySQL command-line client, the user will be permitted to log in but will not be able to issue any statements until the user changes the password.
- DYou receive a syntax error that indicates that you cannot set a password and expire it at the same time.
How the community answered
(49 responses)- A4% (2)
- B6% (3)
- C88% (43)
- D2% (1)
Explanation
When PASSWORD EXPIRE is used in CREATE USER, MySQL allows the user to connect successfully but places the session into sandbox mode - the user reaches the mysql> prompt but every SQL statement they attempt returns an error instructing them to change their password first (via SET PASSWORD or ALTER USER). This is by design: MySQL separates authentication (can you log in?) from authorization to act (can you run queries?).
Why the distractors are wrong:
- A is wrong because the password change does not block the prompt itself - the user gets to
mysql>normally; the restriction kicks in on statement execution. - B is wrong because MySQL does not refuse the connection; the login succeeds, only statement execution is blocked.
- D is wrong because this is perfectly valid MySQL syntax -
PASSWORD EXPIREis an explicit option inCREATE USERand combines legally withIDENTIFIED BY.
Memory tip: Think of sandbox mode as a hotel check-in where you get your key and enter the room (logged in, see the prompt), but the room is locked down until you reset your PIN at the front desk (change the password). You're in - you just can't do anything yet.
Topics
Community Discussion
No community discussion yet for this question.