Get Last Connected Database IP – PHP / MySQL

If you are using multiple database servers, because of load balancing or some other purpose, and you want to do some debugging, or got stuck or confused, or want to know which was the last connected server IP, then you’re at the right place.

MySQL Last Connected DB IPM

To know the IP of last connected database in PHP, all you need to use is the default mysql function, which simply returns you the last connected db ip i.e. mysql_get_host_info()

A code example for the same funciton is given below:
echo mysql_get_host_info();

Hope this helps you in finding your last connected db ip address.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>