Last active
August 2, 2018 13:56
-
-
Save spdeepak/260058370efa52585306f942b9d8564f to your computer and use it in GitHub Desktop.
Run MySQL using Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Start MySQL | |
#MYSQL_ROOT_PASSWORD - for root password | |
#MYSQL_DATABASE - for a startup database | |
#MYSQL_USER, MYSQL_PASSWORD - Now you now what this parameter might be | |
#For more stuff read this page -> https://hub.docker.com/_/mysql/ | |
#1. Start MySQL with a root password, the root admin username will be root | |
docker run --name mysql1 -e MYSQL_ROOT_PASSWORD=root -d mysql:latest | |
#2. Start MySQL without a password. But read the logs to see the password | |
docker run --name mysql1 mysql:latest | |
#3. To see the logs of MySQL start | |
docker logs mysql1 | |
#4. Open MySQL console started by Docker | |
docker exec -it mysql1 mysql -u root -p | |
#5. Stop the MySQL container | |
docker container ls -la | |
docker stop _containerID_ | |
#6. List of all containers | |
docker ps -a | |
#7. Start the stopped container | |
docker start -ai mysql1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment