MySQL – Access Denied to User@localhost

MySQLpermissionsstored-procedures

As a root user I did this:

GRANT DELETE, SELECT, INSERT, UPDATE, EXECUTE ON dbName.* TO
'user'@'localhost' IDENTIFIED BY 'apassword';

In 'dbName' I created a procedure 'proc_name' with definer set to 'user'@'localhost'.

Similarly I create a function 'func_name' with definer set to 'user'@'localhost'.

Now the issue is, I'm able to do select func_name(); but I'm not able to call the procedure proc_name()

When i did :

call proc_name(), I get the below error:

ERROR 1044 (42000): Access denied for user 'user'@'localhost' to database 'dbName'

Any pointers to the solution would be appreciated.

Best Answer

As @Rick suggested in the question comments. We need to grant all the permissions, procName expects. In my case, procName Creates and Deletes temporary tables. So, granting CREATE TEMPORARY TABLES permissions on dbName.* did the trick