> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/secondary-functions/information-functions/session_user.md).

# SESSION\_USER

## Syntax

```bnf
SESSION_USER()
```

## Description

{% tabs %}
{% tab title="Current" %}
Shows the value of [CURRENT\_USER()](/docs/server/reference/sql-functions/secondary-functions/information-functions/current_user.md) when the session was created, that is, it shows a `user@host` pair from the [mysql.global\_priv table](/docs/server/reference/system-tables/the-mysql-database-tables/mysql-global_priv-table.md), like `CURRENT_USER()`, but unlike `CURRENT_USER()` it will not change inside stored routines and views. This is SQL Standard behavior for the `SESSION_USER` function.
{% endtab %}

{% tab title="< 11.7" %}
`SESSION_USER()` is a synonym for [USER()](/docs/server/reference/sql-functions/secondary-functions/information-functions/user.md).
{% endtab %}
{% endtabs %}

Backward-compatible behavior can be restored by setting old mode to [SESSION\_USER\_IS\_USER](/docs/server/server-management/variables-and-modes/old_mode.md#session_user_is_user).

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