MySQL | USER( ) Function
The MySQL USER() function is used for returning the current user name and host name for the MySQL connection being used by the user. This function uses the utf8 character set. The USER() function does not require any parameter to be passed.
The user name returned by the USER() function is the name of the user specified when connecting to the server whereas the host name returned by the USER() function is the name of the client host that the user uses to establish a connection from. The USER() function is similar to the SESSION_USER() function and the SYSTEM_USER() function.
Syntax:
USER()
Parameters Used:
It does not require any parameter or argument to be passed.
Return Value:
The MySQL Version() function returns the version of the MySQL database as a string.
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 USER() function in MySQL.
SELECT USER();
Output:
author@gfg
Recommended Posts:
- MySQL | LEAD() and LAG() Function
- PHP | MySQL UPDATE Query
- PHP | MySQL Database Introduction
- PHP | MySQL ( Creating Database )
- PHP | MySQL ( Creating Table )
- PHP | Inserting into MySQL database
- PHP | MySQL Select Query
- PHP | MySQL Delete Query
- PHP | MySQL ORDER BY Clause
- PHP | MySQL WHERE Clause
- MySQL | CREATE USER Statement
- MySQL | Change User Password
- PHP | MySQL LIMIT Clause
- MySQL | DROP USER
- MySQL | RENAME USER
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

