|Function type:||Information function|
The SYSTEM_USER() function returns the current username and hostname provided during authentication.
The value of SYSTEM_USER() can be different from the value of CURRENT_USER() because it is the user used to authenticate the current client.
SQL Examples for the SYSTEM_USER function
|The examples were created with the MyWAY SQL manager: |
How to use the SYSTEM_USER() function in MySQL and MariaDB databases
|The SYSTEM_USER() function in MySQL and MariaDB is used to get the current combination of username and host for the database session and return it as a string. The function requires no arguments and can be used directly in SQL statements or within SQL queries.|
The function is used to retrieve the current user for the database session so that authentication and authorization logic can be implemented based on the user's identity. SYSTEM_USER() can be used for monitoring or logging purposes to allow tracking of user activity within the database. The retrieved user information can also be used in conditional statements or queries to perform various actions based on the user's identity, such as assigning specific logic or permissions to different users or groups of users.
The username and host combination may depend on the specific authentication mechanisms used by database servers. For security reasons, the username can be an encrypted.
Further MySQL und MariaDB SQL Information functions