SYSTEM_USER() Function in MySQL
Last Updated :
07 Dec, 2020
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
Share your thoughts in the comments
Please Login to comment...