Show MySQL host via SQL Command

后端 未结 4 571
再見小時候
再見小時候 2020-12-04 15:22
Show Database
Use database
show tables
Describe 

All good and well, but is it possible to show the current connections host. Not conne

4条回答
  •  北海茫月
    2020-12-04 15:34

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

    resolveip google.com.sg
    

    docs :- http://dev.mysql.com/doc/refman/5.0/en/resolveip.html

提交回复
热议问题