EC2 instances have an Amazon "internal" IP address (something like 10.228.105.159) and one that can be used from the outside world (e.g. 18.104.22.168).
I used to access a MySQL database only from within the instance itself, but now need to change that. In
/etc/mysql/my.cnf, I've commented out
skip-external-locking, and I replaced
bind-address = 127.0.0.1
... with the EC2 internal IP address, which got remote access working ok (with appropriate EC2 security group settings, of course). But now it can't be accessed by processes locally using a database url such as
Is it possible to both have remote access working and still use "localhost" when connecting to the database locally? If so, how? (Or do I just have to change local configurations to also use an IP like 10.228.105.159 when connecting to the MySQL db on the same host?)