Menu

MySQL SESSION_USER() Function

Updated on

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

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

SESSION_USER() Syntax

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

SESSION_USER()

Parameters

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

Return value

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

SESSION_USER() Examples

The following example shows how to use the SESSION_USER() function to get the current user information .

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

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