Skip to content
Related Articles

Related Articles

SYSTEM_USER() Function in MySQL
  • Last Updated : 07 Dec, 2020
GeeksforGeeks - Summer Carnival Banner

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

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :