MariaDB: CURRENT_USER Function
This MariaDB tutorial explains how to use the MariaDB CURRENT_USER function with syntax and examples.
Description
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.
Syntax
The syntax for the CURRENT_USER function in MariaDB is:
CURRENT_USER( )
Parameters or Arguments
There are no parameters or arguments for the CURRENT_USER function in MariaDB.
Note
- The CURRENT_USER function uses the utf8 character set.
- See also the USER function which can return a different value than the CURRENT_USER function.
- The SESSION_USER and SYSTEM_USER functions are synonyms of the USER function.
Applies To
The CURRENT_USER function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB CURRENT_USER function examples and explore how to use the CURRENT_USER function in MariaDB.
For example:
SELECT CURRENT_USER();
This CURRENT_USER function example would return the user name and host name for the MariaDB account that the server used to authenticate the current client.
So if the MariaDB account that was used by the server to authenticate the current client was 'techonthenet' and the host name was 'localhost':
SELECT USER(); Result: 'techonthenet@localhost'
Advertisements