Skip to content

Instantly share code, notes, and snippets.

@primayudantra
Created November 8, 2018 09:02
Show Gist options
  • Save primayudantra/8f7fe7b8e45b42bc122c9271e13bd8fe to your computer and use it in GitHub Desktop.
Save primayudantra/8f7fe7b8e45b42bc122c9271e13bd8fe to your computer and use it in GitHub Desktop.
Install mysql-docker and allow remote access.
https://hub.docker.com/r/mysql/mysql-server/
----
Install
> docker pull mysql:5.7 (Install Mysql version 5.7)
----
Check Image
> docker image ls
---
Run the Image
> docker run --name container-name -p 3306:3306 -h <server_ip/> -e MYSQL_ROOT_PASSWORD=<mysql_password/> -d mysql:5.7
---
Check Container
> sudo docker ps -a (check active/inactive container)
> sudo docker ps (check active container)
--
Enter Docker Container
> sudo docker exec -it <container_id/> mysql -u root -p
--
Stop Docker Container
> sudo docker stop <container_id>
---
Remove Docker Container
> sudo docker rm <container_id>
---
Remove Docker Image
> sudo docker image rm <image_id/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment