Craig Stewart Craig Stewart - 10 months ago 50
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.


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 :-