MariaDB Tutorial MariaDB Advanced MariaDB Database Account Management MariaDB References

MariaDB CURRENT_USER() Function



The MariaDB CURRENT_USER() function returns the user name and host name for the MariaDB account that was used by the server to authenticate the current client. This function uses the UTF8 character set.

Note that, the CURRENT_USER() function can return a different value than the USER() function.

The SESSION_USER() and SYSTEM_USER() functions are synonyms for the USER() function.

Syntax

CURRENT_USER()

Parameters

No parameter is required.

Return Value

Returns the user name and host name for the current MariaDB user.

Example:

The example below shows the usage of CURRENT_USER() function.

SELECT CURRENT_USER();

The above query will return the user name and host name for the MariaDB account that the server used to authenticate the current client. Therefore if the MariaDB account that was used by the server to authenticate the current client was 'root' and the host name was 'localhost', it will return the following:

SELECT CURRENT_USER();
Result: 'root@localhost'

❮ MariaDB Functions

5