1Z0-909 · Question #10
Examine this event's metadata: Now examine this command: DROP USER 'userl'e'localhost'; Which effect will the command have on the event?
The correct answer is B. The event is scheduled but will no longer execute. The system will log an error. Option B is correct because in MySQL, an event's DEFINER determines the security context under which it runs. When DROP USER 'user1'@'localhost' is executed, the event still exists in the event scheduler (it remains scheduled), but MySQL cannot execute it because the security…
Question
Examine this event's metadata:
Now examine this command:
DROP USER 'userl'e'localhost'; Which effect will the command have on the event?
Options
- AThe event is scheduled and executed but fails. The system will log an error.
- BThe event is scheduled but will no longer execute. The system will log an error.
- CThe event will be dropped without an error or warning.
- DThe event is not scheduled and will no longer execute. The system will log an error.
How the community answered
(53 responses)- A4% (2)
- B74% (39)
- C17% (9)
- D6% (3)
Explanation
Option B is correct because in MySQL, an event's DEFINER determines the security context under which it runs. When DROP USER 'user1'@'localhost' is executed, the event still exists in the event scheduler (it remains scheduled), but MySQL cannot execute it because the security context - the definer - no longer exists. Each time the scheduler attempts to fire the event, it logs an error and skips execution.
Why the distractors are wrong:
- A is wrong because saying the event is "executed but fails" implies the event body actually runs; in reality, MySQL aborts before execution due to the missing definer.
- C is wrong because
DROP USERdoes not cascade to owned events - the event is not automatically dropped; it remains in the system. - D is wrong because the event is still scheduled (it persists in
information_schema.EVENTS); it just cannot run.
Memory tip: Think of the DEFINER as the event's "ID badge." The event stays on the schedule board (scheduled), but without a valid ID badge (definer), it's turned away at the door every time it tries to run, and security logs the incident (error log).
Topics
Community Discussion
No community discussion yet for this question.