Use the code given below, to get the current hostname:
select @@hostname;
show variables where Variable_name like '%host%';
Try the below code, to get hosts for all incoming requests:-
select host from information_schema.processlist;
In mysql document mention this:
resolveip google.com.sg
To resolve IP for the hostname using pure MySQL function, as it is required for a network lookup, refer to this document:
http://dev.mysql.com/doc/refman/5.0/en/resolveip.html