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. 46.137.103.122).
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 mysql://localhost/dbname
.
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?)