Name
CURRENT_USER( )
Synopsis
CURRENT_USER( )
This
function returns the username and the hostname that were given by the
user for the current MySQL connection. There are no arguments for the
function. This function may not always return the same results as
USER( )
.
SELECT CURRENT_USER( ), USER( ); +----------------+------------------+ | CURRENT_USER( ) | USER( ) | +----------------+------------------+ | ''@localhost | russel@localhost | +----------------+------------------+
In this example, the user logged in to the mysql client with the username russel (missing one l in the name), but because there isn’t an account for that user, the client logged in with the anonymous (i.e., " ) account.
Get MySQL in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.