Synology Install MySQL With Portainer

Synology Install MySQL With Portainer

My previous guide for MySQL involved the use of Task Scheduler. Today I’m offering a recommended and excellent alternative for installing the latest MySQL version via Portainer. MySQL is the world’s most popular open source database. With its proven performance, reliability and ease-of-use, MySQL has become the leading database choice for web-based applications, covering the entire range from personal projects and websites, via e-commerce and information services, all the way to high profile web properties including Facebook, X, YouTube, Yahoo! and many more. In today’s article I want to teach you how to install the Docker version of MySQL which will help you set up a database for each Docker package you want to install that requires a MySQL database. In this step by step guide I will show you how to install MySQL on your Synology NAS using Docker & Portainer.

💡Note: This guide works perfectly with the latest MySQL v8.3 release.

  • STEP 1

Please Support My work by Making a Donation.

  • STEP 2

Install Portainer using my step by step guide. If you already have Portainer installed on your Synology NAS, skip this STEP. Attention: Make sure you have installed the latest Portainer version.

  • STEP 3

Install Text Editor via Synology “Package Center”. (Mandatory STEP.) If you already have Text Editor installed on your Synology NAS, skip this STEP.

Synology Install Text Editor 2023

  • STEP 4

Go to File Station and open the docker folder. Inside the docker folder, create two new folders and name them phpmyadmin-mysql and mysql. Follow the instructions in the image below.
Note: Be careful to enter only lowercase, not uppercase letters.

MySQL Synology NAS Portainer Set up 1

  • STEP 5

Download (click on the blue link below) then unzip and upload the uploads.ini file below in the phpmyadmin-mysql folder that you have previously created at STEP 4. Follow the instructions in the image below. 🔒Note: Support my work to unlock the password. You can use this password to download any file on mariushosting forever!

👉🏻Download uploads.ini

MySQL Synology NAS Portainer Set up 2

  • STEP 6

Log into Portainer using your username and password. On the left sidebar in Portainer, click on Stacks then + Add stack. Follow the instructions in the image below.

1 Synology Portainer Add Stack

  • STEP 7

In the Name field type in mysql. Follow the instructions in the image below.

Note: Copy Paste the code below in the Portainer Stacks Web editor.

version: '3.9'
services:
    mysql:
        image: mysql
        healthcheck:
         test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
        restart: on-failure:5
        volumes:
            - /volume1/docker/mysql:/var/lib/mysql:rw
        environment:
            - MYSQL_ROOT_PASSWORD=mariushosting
            - TZ=Europe/Bucharest
            - PGID=100
            - PUID=1026
        ports:
            - 3306:3306
        container_name: MySQL

    phpmyadmin:
        image: phpmyadmin:latest
        healthcheck:
         test: curl -f http://localhost:80/ || exit 1
        restart: on-failure:5
        environment:
            - PMA_PORT=3306
            - PMA_HOST=192.168.1.18
        volumes:
            - /volume1/docker/phpmyadmin-mysql/uploads.ini:/usr/local/etc/php/conf.d/php-phpmyadmin.ini:rw
        ports:
            - 2500:80
        container_name: phpMyAdmin

Note: Before you paste the code above in the Web editor area below, change the value for MYSQL_ROOT_PASSWORD and type in your own password. mariushosting is an example for a password. You will need this password later at STEP 11. ⚠️Warning: Do NOT use a complicated password with special characters.
Note: Before you paste the code above in the Web editor area below, change the value for TZ. (Select your current Time Zone from this list.)
Note: Before you paste the code above in the Web editor area below, change the value numbers for PUID and PGID with your own values. (Follow my step by step guide on how to do this.)
Note: Before you paste the code above in the Web editor area below, change the value of PMA_HOST and add your own LOCAL NAS IP. 192.168.1.18 is my own Synology NAS IP you should use your own Synology NAS IP.

MySQL Synology NAS Portainer Set up 3

  • STEP 8

Scroll down on the page until you see a button called Deploy the stack. Click on it. Follow the instructions in the image below. The installation process can take up to a few minutes. It will depend on your Internet speed connection.

MySQL Synology NAS Portainer Set up 4

  • STEP 9

If everything goes right, you will see the following message at the top right of your screen: “Success Stack successfully deployed“.

MySQL Synology NAS Portainer Set up 5

  • STEP 10

Go back to STEP 1 or you will deal with karma 🙂

  • STEP 11

The installation process can take up to a few seconds/minutes. It will depend on your Internet speed connection. Now open your browser and type in http://Synology-ip-address:2500 Connect to your MySQL using root as Username and the MYSQL_ROOT_PASSWORD you have previously chosen at STEP 7. Click Log in. Follow the instructions in the image below. Note: MySQL doesn’t have a graphical interface; it works in the background. In order to view and create new databases you will need to use phpMyAdmin.

MySQL Synology NAS Portainer Set up 6

  • STEP 12

Your phpMyAdmin container with MySQL database at a glance!

MySQL Synology NAS Portainer Set up 7

  • STEP 13 

Fix the phpMyAdmin configuration storage issue.

Enjoy MySQL!

🆘TROUBLESHOOTING

If you encounter issues by using this container, make sure to check out the Common Docker issues article.

Note: If you want to run the the phpMyAdmin graphical interface container over HTTPS, check How to Run Docker Containers Over HTTPS. In order to make phpMyAdmin work via HTTPS, it’s mandatory to activate WebSocket.

Note: Can I run Docker on my Synology NAS? See the supported models.
Note: Find out how to update the MySQL container with the latest image.
Note: How to Free Disk Space on Your NAS if You Run Docker.
Note: How to Schedule Start & Stop For Docker Containers.
Note: How to Activate Email Notifications.
Note: How to Add Access Control Profile on Your NAS.
Note: How to Change Docker Containers Restart Policy.
Note: How to Use Docker Containers With VPN.
Note: Convert Docker Run Into Docker Compose.
Note: How to Clean Docker.
Note: How to Clean Docker Automatically.
Note: Best Practices When Using Docker and DDNS.
Note: Some Docker Containers Need WebSocket.
Note: Find out the Best NAS Models For Docker.
Note: Activate Gmail SMTP For Docker Containers.

This post was updated on Wednesday / February 21st, 2024 at 1:38 PM