I want to spawn MySQL & PHPMyAdmin docker containers. Mysql container can be accessed via 3306 port & PHPMyAdmin can be accessed through 8280 port.
My question is, how a PHP application can be configured to access the MySQL docker container on 3306 port
and the PHPMyAdmin can be configured for MySQL.
Thanks.
3
Answers
You can use the offical image for MySQL and PHPMyAdmin.
To access it from php container, just add your php container in the docker-compose, so the connection string should be like
You can use Adminer a database management tool.
You need the below configuration in docker-compose.yml for Mysql and adminer.
Start MySQL server
Start phpAdmin with link to mysql container
PHPAdmin application will be serving on localhost:80. MySQL credentials will be root/password.
We can now use docker-compose for this solution which is more portable.