Question:
MySQL only accepts ONE IP to listen on.
So you can either do
bind-address = 127.0.0.1
or
bind-address = 192.168.1.125
with 192.168.1.125 being the same computer as 127.0.0.1, this is, supposed you don’t want to bind to 0.0.0.0.
So if I set it to 192.168.1.125, to allow connecting to it from another computer (e.g. to administer the database, create tables, update etc), then a web application running on 192.168.1.125 will also have to connect via 192.168.1.125.
My question now is this:
Will the performance of database queries run from a web application on machine 192.168.1.125 be worse when the application connects with IP 192.168.1.125 as opposed to when it would connect as 127.0.0.1 ?
Theoretically, it would sent the query via the router back to itselfs, thus slowing performance down as opposed to the loopback interface.
So basically, is the driver/OS sophisticated enough to realize it mustn’t send the data over the network, because this isn’t necessary in this case ?
on Linux, respectively
on Windows should give you the answer 🙂
Yes, the OS is sophisticated enough to not go over the network to the router, and I’m pretty sure it will also not go via the network card. If you really want to make sure there is no performance impact, the best thing is to do some small microbenchmark and compare.