1Z0-888 · Question #41
The following grants were executed: GRANT CREATE ROUTING ON sales.* TO 'webadmin'@'%'; GRANT ALTER ON PROCEDURE sales.myproc TO 'webadmin'@'%'; A user successfully connects to the database as…
The correct answer is C. The stored procedure named get_reports will be dropped. Option C is correct because in MySQL, when a user creates a stored routine, the server automatically grants that user ALTER ROUTINE and EXECUTE privileges on the routine they created - even without an explicit GRANT. Since webadmin created get_reports, they already hold the…
Question
GRANT CREATE ROUTING ON sales.* TO 'webadmin'@'%'; GRANT ALTER ON PROCEDURE sales.myproc TO 'webadmin'@'%'; A user successfully connects to the database as webadmin and created a stored procedure named get_reports. The next day, the user logs in again as webadmin and wants to delete the stored procedure named get_reports, and therefore, issues the following statement: USE sales; DROP PROCEDURE IF EXISTS get_reports; What is the result of executing the statement?Options
- AThe user will get an error because he or she did not use the ALTER statement to drop the stored procedure.
- BThe user will get an error because he or she did not put the database name in front of the stored procedure name.
- CThe stored procedure named get_reports will be dropped.
- DThe user will get an error because he or she does not have the permission to drop stored procedures.
How the community answered
(67 responses)- A7% (5)
- B4% (3)
- C73% (49)
- D15% (10)
Explanation
Option C is correct because in MySQL, when a user creates a stored routine, the server automatically grants that user ALTER ROUTINE and EXECUTE privileges on the routine they created - even without an explicit GRANT. Since webadmin created get_reports, they already hold the implicit ALTER ROUTINE privilege needed to DROP it.
Option A is wrong because ALTER PROCEDURE is used to modify a procedure's characteristics (e.g., SQL SECURITY), not to delete it - DROP PROCEDURE is the correct statement and was correctly used here.
Option B is wrong because the USE sales; statement already sets the default database context, so qualifying the procedure name with sales.get_reports is optional, not required.
Option D is wrong because the automatic implicit grant covers this scenario - webadmin doesn't need an explicit DROP or ALTER ROUTINE grant from an administrator when they own the routine themselves.
Memory tip: Think of routine ownership like file ownership - the person who creates a stored procedure automatically gets the keys to modify or delete it (ALTER ROUTINE), regardless of what was explicitly granted.
Topics
Community Discussion
No community discussion yet for this question.