show variables where Variable_name='hostname';
That could help you !!
I think you try to get the remote host of the conneting user...
You can get a String like 'myuser@localhost' from the command:
SELECT USER()
You can split this result on the '@' sign, to get the parts:
-- delivers the "remote_host" e.g. "localhost"
SELECT SUBSTRING_INDEX(USER(), '@', -1)
-- delivers the user-name e.g. "myuser"
SELECT SUBSTRING_INDEX(USER(), '@', 1)
if you are conneting via ip address you will get the ipadress instead of the hostname.
Maybe
mysql> show processlist;
Source: Stackoverflow.com