W3cubDocs

/MariaDB

CURRENT_USER

Syntax

CURRENT_USER, CURRENT_USER()

Description

Returns the user name and host name combination for the MariaDB account that the server used to authenticate the current client. This account determines your access privileges. The return value is a string in the utf8 character set.

The value of CURRENT_USER() can differ from the value of USER(). CURRENT_ROLE() returns the current active role.

Examples

shell> mysql --user="anonymous"

MariaDB [(none)]> select user(),current_user();
+---------------------+----------------+
| user()              | current_user() |
+---------------------+----------------+
| anonymous@localhost | @localhost     |
+---------------------+----------------+

When calling CURRENT_USER() in a stored procedure, it returns the owner of the stored procedure, as defined with DEFINER.

See Also

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.

© 2019 MariaDB
Licensed under the Creative Commons Attribution 3.0 Unported License and the GNU Free Documentation License.
https://mariadb.com/kb/en/current_user/