Here is my question about MySQL.
After I log in to MySQL using:
mysql -u myname -p
...
mysql>
I wanted to know what the username I used to logon. Is there a way to check this? like "whoami" in unix?
Thanks.
Here is my question about MySQL.
After I log in to MySQL using:
mysql -u myname -p
...
mysql>
I wanted to know what the username I used to logon. Is there a way to check this? like "whoami" in unix?
Thanks.
You can show the current user with CURRENT_USER(), CURRENT_USER or USER() as shown below. *My answer also explains the difference between CURRENT_USER()
or CURRENT_USER
and USER()
:
SELECT CURRENT_USER();
Or:
SELECT CURRENT_USER;
Or:
SELECT USER();
There is a MYSQL function
user()
. To get the user:This will return something like username@hostname.