How can I get the IP address of mysql server running in the localhost machine?
The following query returns 'localhost' because of name resolution.
Select SUBSTRING_INDEX(host,':',1) as 'ip'
From information_schema.processlist
WHERE ID=connection_id();
So what needs to be done to not take the name resolution into consideration or is there any other way of getting the IP address?
Thanks
As for my knowledge you can't directly fetch the ip address of your localhost. But mysql has utitlity which is present in directory
mysql\bin
whose execution file name isresolveip
for that you can execute it like this.In command prompt please give this by pointing your command prompt path to bin directory. For further detail about resolveip click me!!!
It will return text output as like this
IP address of localhost is 127.0.0.1
This function is two way return i.e. Instead of resolved name if you give ip address like this
It will return text output as like this
Host name of 127.0.0.1 is mypc.local, localhost