# CURRENT\_USER

## Syntax

```sql
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](https://mariadb.com/docs/server/reference/data-types/string-data-types/character-sets).

The value of `CURRENT_USER()` can differ from the value of [USER()](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/user). [CURRENT\_ROLE()](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/current_role) returns the current active role.

Statements using the `CURRENT_USER` function are not [safe for statement-based replication](https://mariadb.com/docs/server/ha-and-performance/standard-replication/unsafe-statements-for-statement-based-replication).

## Examples

```sql
shell> mysql --user="anonymous"

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

* [USER()](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/user)
* [SESSION\_USER()](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/session_user)
* [CREATE PROCEDURE](https://mariadb.com/docs/server/server-usage/stored-routines/stored-procedures/create-procedure)

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}
