Introduction
Kitematic is a GUI based tool for the management of Docker containers on Mac or windows. It's primarily focused on developers who are more interested in creating and using Docker containers rather than remembering the CLIS commands.
In this blog, we will learn about setting up a containerized MySQL database instance on Mac using Kitematic.
Setup Docker & Kitematic
- Create a free Docker Hub account by visiting this link. This will help in easily searching and downloading docker images from Docker Hub. For those who don't know, Docker Hub is the library and community for container images managed by Docker Inc.
- Install the Docker Desktop depending on your operating system. Use this link for Windows and this for Mac. We will be using Mac in the rest of this blog, but steps for Windows will be similar (if not exactly the same). Installation instructions are given on the setup download page itself for both Mac and Windows.
- Install Kitematic depending on your operating system. Use this link to download the setup zip file. To install just unzip the file, double click the setup file and follow the setup instruction of the setup exe.
- Once Docker is installed, click the Docker icon in applications and you will see the Whale in the menu bar, like in the following image.
- Click on the Whale Icon and click on Sign In/Create Docker ID option as shown in the following screenshot.
- It will open the following screen. Enter your Docker Hub credentials and click on the Sign In button.
- Once successfully logged in, you can see your user ID in place of Sign In/Create Docker ID in the Docker menu like the following screenshot.
- To Open Kitematic, click on the Kitematic Icon in applications. You will get the following screen. Here, on the top left you will see your Docker Hub user ID which Kitematic will automatically pick from Docker Desktop. On the left side, you will see all the containers you have. On the right, you will see a list of container images from the Docker Hub.
Setup MySQL Server on Containers
To set up MySQL, use the following steps:
- Make sure that Docker for Desktop is running and open Kitematic and search for MySQL on the search window, which will show the official MySQL image as shown in the following screenshot,
- Once you click on Create button to start the installation, Kitematic will show the following screen:
- Once installation is complete, you will get the following screen.
As shown in the log message of the above screenshot, the server will not start until we set the root password of the server. Since we are doing this setup for local development, we will allow an empty root password for the server.
- To set an Empty root password, click on the Settings Tab and set MYSQL_ALLOW_EMPTY_PASSWORD as true in environment variables as shown in the below screenshot.
- Now Click on the Start button to start the server. Once the server is started, you will be able to see the Running status and Stop button like shown in the below screenshot.
- Now the MySQL server is ready to connect. Click on Hostnames/Ports sub-tab under the Settings tab and note the port number as highlighted in the below screen.
- Open MySQL Workbench, which is the GUI for managing MySQL databases (you can download that here). Once opened, you will get the following home screen. Click on + icon as highlighted in the above screenshot.
- On clicking the + icon, you will get the following screen where you have to give the Connection Name, Host Name, Port Number (taken from Step 6 ) as shown in the below screenshot. Click Test Connection.
- If the connection is successful, you will see the following screen mentioning the connection is successful.
- Once you click Ok on this screen and create a connection screen, you will see the connection listed on Home of My WorkBench like in the below screenshot.
- Once you click on the connection shown on the previous step, you will be connected to MySQL database and get the following screen where you can do all database management operations.
Conclusion
This is how we can setup containerization MySQL on Mac or Windows (steps will be exactly similar) using Docker Desktop and Kitematic.