Open In App

SYSTEM_USER() Function in MySQL

SYSTEM_USER() :
This function helps to return the name of the user and hostname for the current MySQL user. And the SYSTEM_USER() function doesn’t require any parameter to be passed.

The username which will be returned is the name of the user-specified when connecting to the server. And the hostname will be the name of the client host that to whom the user is connected.



Note –
The function SYSTEM_USER() and SESSION_USER() are almost similar.

Syntax :



SYSTEM_USER()

Parameters :
This function doesn’t require any parameter or argument to be passed.

Returns :
The function will return the name of the user and hostname for the current MySQL user.

Supported Versions of MySQL :

Example :
Implementing SYSTEM_USER() function in MySQL as follows.
Syntax –

SELECT SYSTEM_USER();

Output :

//Expected Output will be in this format.
username@hostname

Now, Let’s see the example.

SELECT SYSTEM_USER();

Output :

author@gfg
Article Tags :
SQL