MySQL Server and Workbench via Docker
- Norma López-Sancho
- Mar 17, 2024
- 2 min read
Updated: Apr 12, 2024
This is a quick guide to get a MySQL container in Docker and connect it to MySQL workbench.
1. Getting MySQL Server into a Docker Container
Pulling the official MySQL image into docker and create the MySQL server with the below code in your Terminal
docker run -d -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=magical mysql
With this simple line you don’t need to pull the image separately as if it does not find it, will download the latest available version itself:
2. Connecting the Server to MySQL Workbench
First download the workbench from here
If you don’t know your OS Version, check on the top left corner, in the apple icon ‘About this Mac’ to see if your processor is INTEL (then would be X86) or if says Apple M1 or M2 (then it’s ARM)
At the time of writing this, the Workbench has been tested up to MySQL Server 8.0 and not the latest version available, therefore when you try connecting them both, will prompt the following:
Ok, no problemo: let’s delete the container & image we have created (which you can do by pressing the bin icon on your docker container first and image after) and start again with a slightly modified command to target a specific version of the server's image:
docker run -d -p 3306:3306 --name mysql8 -e MYSQL_ROOT_PASSWORD=magical mysql:8.0
Let's try connecting them now!
On the home screen press the + where it says MySQL Connections and set the parameters as below (default user if you do not define it, is always ‘root’)
Press test connection and there we go, successful connection without warnings:
Let’s play a bit, shall we?


Let's play, shall we?
In my next article we will start by creating a play_ground and have some fun using SQL basic statements on the workbench to get to know it more and will jump straight onto an intermediate level around things worth to keep in mind since the beginning when working with data.
Comments