Craig Stewart Craig Stewart - 1 year ago 94
MySQL Question

Show MySQL host via SQL Command

Show Database
Use database
show tables
Describe <table>

All good and well, but is it possible to show the current connections host.
Not connection_id, but the IP Address or Name of the host.

Answer Source

To get current host name :-

select @@hostname;
show variables where Variable_name like '%host%';

To get hosts for all incoming requests :-

select host from information_schema.processlist;

Based on your last comment,
I don't think you can resolve IP for the hostname using pure mysql function,
as it require a network lookup, which could be taking long time.

However, mysql document mention this :-


docs :-

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download