Windows Docker Mysql

  1. Windows Docker Sql Server
  2. Windows Docker Mysql Volume

In this article, we are going to see a step-by-step tutorial on how to run a MySQL database in a Docker Container.

Updated on December 4th, 2020 in #dev-environment, #docker. Setting Up Docker for Windows and WSL to Work Flawlessly With a couple of tweaks the WSL (Windows Subsystem for Linux, also known as Bash for Windows) can be used with Docker for Windows. The following command will pull the MySQL server version 8.0.20 from the Docker registry and then instantiate a Docker container with the name “mk-mysql.” It will also attach the previously created volume “mysql-volume” with the Database and will expose the port 3306 so that you can reach the MySQL database outside the container.

For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual. Mysqlcontainer 2021-10-05T14:44Z 0 ERROR MY-010119 Server Aborting mysqlcontainer 2021-10-05T14:94Z 0 System MY-010910 Server /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.26. MySQL is one of the most popular database systems available today. In this guide, we’ll walk you through how to install MySQL in your Docker container on Windows. Installing Docker. If you don’t already have Docker, you can download the installer from the Docker website. Run the installer with the default configuration options.

1.Downloading a MySQL Server Docker Image

To download the image, open the command line and type this command:

The :latest tag will download the latest version of MySQL. If you want do download a specific version, simply replace the
latest (Ex: mysql-server :8.0)


2.Start a MySQL Container in Docker

The next step is to run a container in Docker with the MySQL image. To do this, execute the next command:

Let’s break down this command to understand it better:

  • run - will run a new command in a new Docker container
  • –name - will give a name to the new container created
  • -p - will make the internal docker port visible outside docker
  • -e - will change the root password. Here you can insert whatever password you want
  • mysql/mysql-server:8.0 - will specify what image to run in the newly created container

To verify if the container was created and running, we can execute a docker ps (process status) command:

Windows docker mysql commandWindows

This will list all the running containers as shown above.

In the status column of the result from above, you can see the (health: starting) mention. After the container is initialized
and ready to run, you will se it change to (healthy).

Windows Docker Mysql

3.Connecting to MySQL Server from within the container

To connect, we will first run the next command:

This will require the root password set in the previous step. After inserting the password, you should be inside MySQL

Windows Docker Sql Server

Type exit to leave the program.

4.Stopping the MySQL container

To stop the container, simply execute the next command:

Windows Docker Mysql Volume


5.Deleting the MySQL container

To delete the container, make sure that it is stopped. Then, execute this command:

Share this blog post on Twitter, Facebook, and LinkedIn