Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have multiple text console session open and log in as different users into different consoles. I forget after while which consoles belong to which user, it would be nice to not have to quit and log back in.

How do I see which user I am logged in as?

Is there a way to change which user I logged in as with out logging out?

share|improve this question

3 Answers 3

up vote 14 down vote accepted

Actually, you need to use two functions

SELECT USER(),CURRENT_USER();

USER() reports how you attempted to authenticate in MySQL

CURRENT_USER() reports how you were allowed to authenticate in MySQL

Sometimes, they are different

share|improve this answer

Does

select user();

work?

I pinched it from the 3rd google result for 'mysql whoami':

share|improve this answer

I found this user() function

select user(); Will show you which user is logged in.

share|improve this answer
    
Does that link still work for you? I decided to link to google's cache because of the mysql -> oracle breakage. –  PriceChild Apr 5 '11 at 8:00
    
It does work, it has an other interesting function as well select database(); will show you your currently selected database. –  nelaar Apr 5 '11 at 8:07
    
That's really annoying, I wonder why it doesn't work for me. Thanks. –  PriceChild Apr 5 '11 at 8:08
    
@pricechild dev.mysql.com/doc/refman/5.5/en/… –  nelaar Apr 5 '11 at 8:21
    
Nope, sends me to search.oracle.com/search/… –  PriceChild Apr 5 '11 at 8:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.