Skip to content

Instantly share code, notes, and snippets.

@macoding777
Forked from primayudantra/mysql-docker.txt
Last active July 10, 2022 22:14
Show Gist options
  • Save macoding777/053a8367a481a47690b1d05a5c6771fa to your computer and use it in GitHub Desktop.
Save macoding777/053a8367a481a47690b1d05a5c6771fa 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
----
Check Image
> docker image ls
---
Run the Image
> docker run --name container-name -p 3306:3306 -h 0.0.0.0 -e MYSQL_ROOT_PASSWORD=satupassword -d mysql --max_connections=1000000
---
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