SyntaxStudy
Sign Up
MySQL Intermediate 3 min read

Event Privileges

Event Permissions

The EVENT privilege controls who can create, alter, and drop events. Events run with the DEFINER user's privileges by default.

Example
-- Grant event privilege to a user
GRANT EVENT ON mydb.* TO "app_user"@"localhost";
-- Show grants
SHOW GRANTS FOR "app_user"@"localhost";
-- Create event with specific definer
CREATE DEFINER = "admin"@"localhost" EVENT secure_cleanup
ON SCHEDULE EVERY 1 HOUR DO DELETE FROM sessions WHERE expired = 1;
-- Event runs with admin privileges, not the user who created it via app_user
Pro Tip

The DEFINER runs the event code — use a dedicated service account with minimal required privileges.