All pages
Powered by GitBook
1 of 1

Loading...

USER

Return the current MariaDB user. This function returns the user name and host name provided by the client upon connection.

Syntax

Description

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 .

Examples

To select only the IP address, use ,

See Also

This page is licensed: GPLv2, originally from

USER()
CURRENT_USER()
CURRENT_ROLE()
SESSION_USER
safe for statement level replication
SUBSTRING_INDEX()
CURRENT_USER()
fill_help_tables.sql
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                    |
+----------------------------------+