Containerised MySQL on Mac Using Kitematic

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

  1. 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.
  2. 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.
  3. 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.
  4. 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.

    Containerised MySQL On Mac Using Kitematic

  5. Click on the Whale Icon and click on Sign In/Create Docker ID option as shown in the following screenshot.

    Containerised MySQL On Mac Using Kitematic

  6. It will open the following screen. Enter your Docker Hub credentials and click on the Sign In button.

    Containerised MySQL On Mac Using Kitematic

  7. 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.

    Containerised MySQL On Mac Using Kitematic

  8. 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.

    Containerised MySQL On Mac Using Kitematic

Setup MySQL Server on Containers

 
To set up MySQL, use the following steps:
  1. 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,

    Containerised MySQL On Mac Using Kitematic

  2. Once you click on Create button to start the installation, Kitematic will show the following screen:

    Containerised MySQL On Mac Using Kitematic

  3. Once installation is complete, you will get the following screen.

    Containerised MySQL On Mac Using Kitematic

    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. 

  4. 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.

    Containerised MySQL On Mac Using Kitematic

  5. 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.

    Containerised MySQL On Mac Using Kitematic

  6. 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.

    Containerised MySQL On Mac Using Kitematic

  7. 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.

    Containerised MySQL On Mac Using Kitematic

  8. 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.

    Containerised MySQL On Mac Using Kitematic

  9. If the connection is successful, you will see the following screen mentioning the connection is successful.

    Containerised MySQL On Mac Using Kitematic

  10. 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.

    Containerised MySQL On Mac Using Kitematic
  1. 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.

    Containerised MySQL On Mac Using Kitematic
 
Conclusion 
 
This is how we can setup containerization MySQL on Mac or Windows (steps will be exactly similar) using Docker Desktop and Kitematic.