Return the current MariaDB user. This function returns the user name and host name provided by the client upon connection.
Returns the current MariaDB user name and host name, given when authenticating to MariaDB, as a string in the utf8 character set.
The value of USER() may differ from the value of , which is the user used to authenticate the current client. returns the currently active role.
SYSTEM_USER() is a synonym for USER().
SYSTEM_USER() and are synonyms for USER().
Statements using the USER() function or one of its synonyms are not .
To select only the IP address, use ,
This page is licensed: GPLv2, originally from
USER()shell> mysql --user="anonymous"
SELECT USER(),CURRENT_USER();
+---------------------+----------------+
| USER() | CURRENT_USER() |
+---------------------+----------------+
| anonymous@localhost | @localhost |
+---------------------+----------------+SELECT SUBSTRING_INDEX(USER(), '@', -1);
+----------------------------------+
| SUBSTRING_INDEX(USER(), '@', -1) |
+----------------------------------+
| 192.168.0.101 |
+----------------------------------+