22

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.

2

2 Answers 2

44

There is a MYSQL function user(). To get the user:

SELECT USER();

This will return something like username@hostname.

Sign up to request clarification or add additional context in comments.

2 Comments

mysql> STATUS; will list all info, if you need to do this from console. (dev.mysql.com/doc/refman/5.0/en/installation-version.html)
Please update the URL which u have added.
0

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();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.