Using MySQL from Docker Container

Installing MySQL in a Docker container is easier to use and quick. It will not mess up the OS and whenever needed it can be started and stopped simply by issuing the Docker containers commands. Just follow the simple steps below.

  1. pull the MySQL Docker image from Docker Hub.

docker pull mysql

2. Now run the MySQL container

docker run --name mysql-database -e MYSQL_ROOT_PASSWORD=root -d mysql

3. Verify the MySQL container is running.

docker container ls

4. Install MySQL Workbench client to connect this database.

Download from MySQL site.

5. After installation issue below docker command to know the host name/IP of running container.

docker inspect mysql-database

Towards the bottom of results , there will be an attribute “IPAddress”, use this field’s value in client as host name and use the ‘root’ as user name and password.

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *