Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

check current user in mysql command line

Tags:

mysql

Here is my question about mysql.

After i logon 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.

like image 258
totally Avatar asked Feb 23 '15 06:02

totally


1 Answers

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

SELECT USER();

This will return something like username@hostname.

like image 133
Ataboy Josef Avatar answered Oct 22 '22 20:10

Ataboy Josef