Open In App

SYSTEM_USER() Function in MySQL

Improve
Improve
Like Article
Like
Save
Share
Report

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 :

  • MySQL 5.7
  • MySQL 5.6
  • MySQL 5.5
  • MySQL 5.1
  • MySQL 5.0
  • MySQL 4.1
  • MySQL 4.0
  • MySQL 3.23

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

Last Updated : 07 Dec, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads