Mysql – Non Super User cannot alter stored procedures and functions

MySQLphpmyadmin

I am running into an issue granted a user access to alter stored procedures and functions within MySQL 5.7.22-0 running on Ubuntu.

  • User has ALL PRIV on the database except GRANT
  • User has SELECT PRIV on mysql.proc
  • User can DROP and CREATE –> they can not ALTER

Here is the output from SHOW GRANTS

SHOW GRANTS FOR 'userA'@'%'

GRANT USAGE ON *.* TO 'userA'@'%'   
GRANT ALL PRIVILEGES ON `mydatabase`.* TO 'userA'@'...  
GRANT SELECT ON `mysql`.`proc` TO 'userA'@'%'   

Output for SHOW CREATE PROCEDURE on a specifc pro

SHOW CREATE PROCEDURE mydatabase.spAddEmailListContact

spAddEmailListContact   NO_AUTO_VALUE_ON_ZERO   

CREATE DEFINER=`userB`@`%` PROCEDURE `spAddEmailListContact`(
        IN `EmailListID` INTEGER(11),
        IN `CustID` INTEGER(11),
        IN `ContactID` INTEGER(11))
    MODIFIES SQL DATA
BEGIN
INSERT INTO 
  emaillistcontacts
(
  EMAILLIST_ID,
  CUST_ID,
  CUSTCNT_ID
) 
VALUES (
  EmailListID,
  CustID,
  ContactID
);
END utf8mb4 utf8mb4_general_ci  latin1_swedish_ci   

Any thoughts on what I am missing?

Note: A key requirement is to allow SEVERAL developers to edit procedures without requiring them to be super users. (this is so simple to do in mssql :-/ it surprises me that this is difficult in mysql)

Best Answer

Perhaps you want this in the CREATE:

SQL SECURITY INVOKER

or, more likely,

SQL SECURITY DEFINER