This tutorial explains how to use the MySQL CURRENT_USER function with syntax and examples.
The MySQL CURRENT_USER function returns the user name and host name for the MySQL account that was used by the server to authenticate the current client.
The syntax for the CURRENT_USER function in MySQL is:
There are no parameters or arguments for the CURRENT_USER function in MySQL.
The CURRENT_USER function can be used in the following versions of MySQL:
Let's look at some MySQL CURRENT_USER function examples and explore how to use the CURRENT_USER function in MySQL.
For example:
This CURRENT_USER function example would return the user name and host name for the MySQL account that the server used to authenticate the current client.
So if the MySQL account that was used by the server to authenticate the current client was 'root' and the host name was 'localhost':