MySQL SYSTEM_USER() Function

The MySQL SYSTEM_USER() function returns the username and hostname of the current MySQL account.

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

SYSTEM_USER() Syntax

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

SYSTEM_USER()

Parameters

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

Return value

The SYSTEM_USER() function returns a UTF8 string that is the username and hostname of the current MySQL account.

SYSTEM_USER() Examples

The following example shows how to get the current user information using the SYSTEM_USER() function.

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

Here, the username of the current user is root, and ths hostname of the current user is 192.168.0.204.