How to Install phpMyAdmin on MacOS or Windows use Docker

Introduction

PhpMyAdmin is a free and open source tool for the administration of MySQL and MariaDB. As a portable web application written in PHP, it has become one of the most popular administration tool for MySQL. In this tutorial, we will learn the steps involved in the installation of phpMyAdmin on MacOS. 

Prerequisites

  • MacOS
  • Docker

1. Obtaining and running MariaDB docker container

Open a terminal and run the command below in order to check your docker installation.
$ docker version
Client:
 Cloud integration: 1.0.14
 Version:           20.10.6
 API version:       1.41
 Go version:        go1.16.3
 Git commit:        370c289
 Built:             Fri Apr  9 22:46:57 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.6
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.13.15
  Git commit:       8728dd2
  Built:            Fri Apr  9 22:44:56 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.4
  GitCommit:        05f951a3781f4f2c1911b05e61c160e9c30eaa8e
 runc:
  Version:          1.0.0-rc93
  GitCommit:        12644e614e25b05da6fd08a38ffa0cfe1903fdec
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
Now you can run it into your local
$ docker run --name startervm-db -e MYSQL_ROOT_PASSWORD=123 -p 3306:3306 -d mariadb
Let's explain the options for the command docker run.
 
  • The option --name Assign a name to the container.
  • The option -e is used to pass for container environment var MYSQL_ROOT_PASSWORD. this var required by image to run properly and it will be assigned to the root password of MySQL. More info
  • The option -p Publish a container's port(s) to the host.
  • The option -d detach Run container in background and print container ID.
  • Finally, we need to indicate docker to use the image mysql:8.0.1 just downloaded, to run the container.

2. Obtaining and running phpMyAdmin docker container and link db-startervm [mariadb]

Once the container running MySql server is working, the next step is configuring another container with phpMyAdmin. [More info]
we need to run the container making sure that the container connects with the other container running mysql. In order to do so we type the following command
 
$ docker run --name startervm-phpmyadmin -d --link startervm-db:db -p 8081:80 phpmyadmin/phpmyadmin
 
Let's explain the options for the command docker run.
 
  • The option --name Assign a name to the container.
  • The option -d detach Run container in background and print container ID.
  • The option —link Add link to another container.
  • The option -p Publish a container's port(s) to the host.
If everything went well you could see the running container by typing the following command:
 
$ docker ps -a
The terminal should displays something like:


 

3. Access phpMyAdmin

 
Yes, that's all…everything is done! Easy right? You only need to open your favourite browser and type the following url: http://localhost:8081/ so your instance of phpMyAdmin will show up. To access, type root as username and the password you established in the step one when running the mysql container (if you followed the tutorial the password is 123). 
 

 



Post a Comment

0 Comments