Jump toUpdate content
Deploying phpMyAdmin with Docker to manage MySQL Databases
- Instance
- phpMyAdmin
- Docker
- Docker-InstantApp
- MySQL-database
Managing a database can be a complex and laborious part when running a web application. Softwares like phpMyAdmin exist to make the process much lighter. It is a popular administration tool that allows you to access and manage your databases much more easily.
In this tutorial you learn how to deploy the tool on a Instance using the Docker InstantApp.
- You have an account and are logged into the Scaleway console
- You have configured your SSH Key
- You have a MySQL database
Creating a Docker Instance
Click Instances in the Compute section of the side menu. The Instances overview displays.
Click + Create an Instance. The instance creation wizzard displays.
Configure your Instance:
- Choose the availability zone.
- Select the Instance type (in this tutorial we use a DEV1-S Instance)
- Select the Image for the Instance: Click the InstantApps tab and select the Docker image.
- If required, configure storage options
- Enter a name for the instance and optionally tags for it
Click Create a new Instance to launch its creation. Once the instance is ready, you are redirected to it’s information page.
Deploying phpMyAdmin
Connect to your instance using SSH:
ssh root@<your_instance_ip>
Download the official Docker image by running the following command:
docker pull phpmyadmin
Run the container with the following command:
docker run --name phpmyadmin -d -e PMA_HOST=$DB_HOST -e PMA_PORT=$DB_PORT -p 8080:80 phpmyadmin
- Replace
$DB_HOST
with the hostname or IP of your MySQL server. - Replace
$DB_PORT
with the port your MySQL server is listening on.
Tip:If you are using a Managed Database for MySQL you can find the connection details on the Database information page:
- Replace
Open a web browser tab and go to
http://<your_instance_ip>:8080
. The phpMyAdmin login displays:Enter your MySQL credentials and click Go. The phpMyAdmin Dashboard displays:
You can now manage your MySQL databases using the graphical interface of phpMyAdmin.
For security reasons you should stop the Docker container after you completed your database maintenance.
To stop the container run the following command:
docker stop phpmyadmin
To restart the container, repeat the steps above.