Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (20.3k points)

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.

1 Answer

0 votes
by (40.7k points)

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

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 11, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...