Invoker

Access Control in MySQL Stored Routines: DEFINER, INVOKER & SQL SECURITY

MySQL Stored Routines (functions and procedures) are not only used for improving performance but also they’re handy when it comes to enhancing security and restricting user access. This post briefs you about security aspects of stored routines by means of example. By the definition of a Stored Routine, – DEFINER clause specifies the creator of the stored routine. – SQL SECURITY clause specifies the execution context of the stored routine. Now let’s start with an example: Create a very basic stored routine in test database: DELIMITER // CREATE PROCEDURE user_cnt() BEGIN SELECT COUNT(*) as total_user FROM mysql.user; END;// DELIMITER ;...