Menu

MySQL USER() Function

Updated on

The MySQL USER() function returns the user name and host name provided by the client connection.

The USER() function is equivalent to SYSTEM_USER() and SESSION_USER().

USER() Syntax

Here is the syntax of the MySQL USER() function:

USER()

Parameters

The MySQL USER() function does not require any parameters.

Return value

The USER() function returns a string containing the user name and host name presented by the client connection.

USER() Examples

The following example shows the user name and host name presented by a client connection.

SELECT USER();
+--------------------+
| USER()      |
+--------------------+
| [email protected] |
+--------------------+

This illustrative output shows the client account and host returned for the current connection.