I'm trying to setup mysql replica. On master when I change bind-address
value in my.cnf
to server's IP address some of websites break as they are using 127.0.0.1
as database host value.
There are few other sites (WordPress) which work because WP uses localhost
as db host value.
It is production server so I don't have liberty to change 127.0.0.1
to localhost
on all those sites which break or experiment with changes.
Is there any other way by which I can keep mysql configuration bind-address
value to be server's IP and it works with either localhost or 127.0.0.1 specified in the websites' configurations?
This is my /etc/hosts, some values are redacted
# cat /etc/hosts
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1 localhost ns123456
xx.xx.xx.xx ns123456.ip-11-22-33.net ns123456
Updates
There is nice discussion on https://stackoverflow.com/questions/19712307/mysql-localhost-127-0-0-1 however it doesn't provide a clear answer.
[email protected]
,[email protected]
,[email protected]
, andusername@localhost
? They are all distinct.