# 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](/docs/server/reference/data-types/string-data-types/character-sets.md).

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

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

## 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()](/docs/server/reference/sql-functions/secondary-functions/information-functions/user.md)
* [SESSION\_USER()](/docs/server/reference/sql-functions/secondary-functions/information-functions/session_user.md)
* [CREATE PROCEDURE](/docs/server/server-usage/stored-routines/stored-procedures/create-procedure.md)

<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" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/current_user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
