For the complete documentation index, see llms.txt. This page is also available as Markdown.

SET SESSION AUTHORIZATION

Impersonate another user for the current session. Learn how to assume the identity and privileges of another account for testing or administration.

This statement is available from MariaDB 12.0.

Certain users can perform server actions as another user:

Examples

SELECT USER(), CURRENT_USER(), DATABASE();
+--------------------+--------------------+------------+
| user()             | current_user()     | database() |
+--------------------+--------------------+------------+
| msandbox@localhost | msandbox@localhost | test       |
+--------------------+--------------------+------------+
1 row in set (0.000 sec)
SET SESSION AUTHORIZATION foo@localhost;
SELECT USER(), CURRENT_USER(), DATABASE();
+---------------+----------------+------------+
| user()        | current_user() | database() |
+---------------+----------------+------------+
| foo@localhost | foo@%          | NULL       |
+---------------+----------------+------------+

This page is licensed: CC BY-SA / Gnu FDL

Last updated

Was this helpful?