MySQL user access locally vs. production

Hi everyone! I’m hoping someone here can lend a hand. :slight_smile:

I’m building a small web app that has a container for PHP and a container for MySQL. I have no issues with my created mysql users accessing the MySQL when using Docker locally. The users that are created in MySQL look like this:

'user1'@'111.111.111.1'

This '111.111.111.1' IP address is within my network as defined by my docker-compose.yml file.

However, when loading the identical files and scripts on an AWS EC2 instance, using ubuntu (while I develop on Windows 10 locally), even though the IP address is still defined, they can’t connect. I did discover that they can connect when the @ is 'docker_container_name.docker_network'.

However, that won’t work locally for some reason, even though containers are named consistently and identically, as is the shared network.

On AWS, localhost as well other IPs in the network (111.111.111.2 or .3 for example) don’t work.

TL;DR: My MySQL users (short of using @'%') require different hosts to connect from based on whether the containers are running locally versus on the AWS EC2 instance. Anyone run into this? Thanks for any help you might be able to provide!

Julie :slight_smile: