totn MariaDB Functions

MariaDB: SYSTEM_USER Function

This MariaDB tutorial explains how to use the MariaDB SYSTEM_USER function with syntax and examples.

Description

The MariaDB SYSTEM_USER function returns the user name and host name for the current MariaDB user.

Syntax

The syntax for the SYSTEM_USER function in MariaDB is:

SYSTEM_USER( )

Parameters or Arguments

There are no parameters or arguments for the SYSTEM_USER function in MariaDB.

Note

  • The user name returned is the name of the user specified when connecting to the server.
  • The host name returned is the name of the client host that the user connected from.
  • The SESSION_USER and SYSTEM_USER functions are synonyms for the USER function.
  • See also the CURRENT_USER function which can return a different value than the SYSTEM_USER function.

Applies To

The SYSTEM_USER function can be used in the following versions of MariaDB:

  • MariaDB 10

Example

Let's look at some MariaDB SYSTEM_USER function examples and explore how to use the SYSTEM_USER function in MariaDB.

For example:

SELECT SYSTEM_USER();

This SYSTEM_USER function example would return the user name and host name for the current MariaDB user.

So if the user name specified when connecting to the server was 'techonthenet' and the name of the client host that the user connected from was 'localhost':

SELECT SYSTEM_USER();
Result: 'techonthenet@localhost'