Try the CURRENT_USER() function. This returns the username that MySQL used to authenticate your client connection. It is this username that defines your privileges.
This may differ from the username that was sent to the client in MySQL (for example, MySQL may use an anonymous account to authenticate your client, even if you sent the username). If you want the username that the client sent to MySQL when connecting, use the USER() function instead.
The value indicates the username that you provided when connecting to the server, and the client host from which you connected. The value may differ from the value of CURRENT_USER ().
http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_current-user
scotru Oct 13 '13 at 21:07 on 2013-10-13 21:07
source share