Server: MySQL 5.7.14 I am following the Suggestion 1 suggested here https://dba.stackexchange.com/a/109416/126860

I am trying to find out which user called the stored procedure. But since I am also using a definer. The CURRENT_USER(); function returns the "definer" user name.

I have tried using SHOW PROCESSLIST; to find out who is running the stored procedure. but it doesn't show stored procedures as a separate process.

Is there a way to find the actual user who invoked the stored procedure.

1 Answer 1


Back on Jan 10, 2012, I answered MySQL error: Access denied for user 'a'@'localhost' (using password: YES) where I show two function calls:

  • USER() reports how you attempted to authenticate in mysqld
  • CURRENT_USER() reports how you were allowed to authenticate by mysqld

Since CURRENT_USER() shows the definer, try using USER(). It might display the MySQL user and the host where that user was coming in from. Please note that this may not work if USER() is an internal thread running the Stored Procedure.

  • Yes. User() works when using definers.
    – nwarriorch
    Commented Aug 18, 2017 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.