MySQL SESSION_USER() Function
The MySQL SESSION_USER()
function returns the username and hostname of the current MySQL account.
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 UTF8 string that is the username and hostname of the current MySQL account.
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] |
+--------------------+
Here, the username of the current user is root
, and ths hostname of the current user is 192.168.0.204
.