Using MySQL with Docker and docker-compose makes it very easy and fast to test out any changes in any application using MySQL as the database. In this tutorial, we will detail how to use MySQL with Docker and docker-compose step-by-step keeping things easy to comprehend. Let’s get started!
You can see mysql dump and backup commands from docker container here.
https://github.com/bkglobal/mysql_docker_utilities/blob/main/mysql-commands.sh
Install my-project with npm
Checkout repository.
git clone git@github.com:bkglobal/mysql_docker_utilities.gitGo to the directory.
cd mysql_docker_utilitiesRename env file (from env to .env)..
mv env .envNow open .env file and edit the following environment variables.
MYSQL_DATABASE: 'db'
# So you don't have to use root, but you can if you like
MYSQL_USER: 'user'
# You can use whatever password you like
MYSQL_PASSWORD: 'password'
# Password for root access
MYSQL_ROOT_PASSWORD: 'password'Open docker-compose.yml file and reset it according to your need.
You can find mysql latest images in official mysql docker image link..
Commands
Run docker container on foreground.
docker-compose -f docker-compose-mysql.yml upRun docker container on background.
docker-compose -f docker-compose-mysql.yml up -dStop container.
docker-compose down