46

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?

fixer1234
  • 28,064
nelaaro
  • 14,139
  • 30
  • 88
  • 115

4 Answers4

60

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

2

I found this user() function

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

nelaaro
  • 14,139
  • 30
  • 88
  • 115
2

You can use 'status':

MariaDB [my_database]> status

Current user: root@localhost

JohnW.
  • 21
1

Does

select user();

work?

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

Pricey
  • 4,710