Local MySQL = Docker + Docker Compose + MySQL Docker image + Adminer Docker image
On folder that contains docker-compose.yml
type one of this.
// non detach mode
docker-compose up
or
// detach mode
docker-compose up -d
It will spin the MySQL latest version, expose port to host at 3306 and ready connection via Adminer or mysql
CLI command.
To shutdown database without remove the container.
docker-compose stop
To shutdown database and remove the container.
docker-compose down
Is data that already created will gone? No, since in the Docker Compose file you can see that we utilize data container named mysql_db_data_container
to store the MySQL data.
- Username: root
- Password: rootpassword
Go to http://localhost:8080
Make sure you have MySQL client installed and mysql
command in CLI available.
mysql -uroot -prootpassword -h 127.0.0.1
or
mysql -uroot -prootpassword --protocol=TCP
Enjoy your local MySQL database server for any purpose you want, for me this setup is fine for testing purpose.