Installing MySQL on Synology NAS using Docker

Hope you all had a Merry Christmas! You did? Oh, splendid!

Enough of that, lets hop straight in. 

So… you want to run a MySQL database on your Synology NAS. Since you can’t do it straight out the box, we will be using docker to get this up and running. 

Now, no matter what I did, I could not get the MySQL docker image to work at all using the GUI so we’ll be using the Synology’s built in SSH terminal for this task. Lets do that first.

Prerequisite

As mentioned above, Docker behaves weird for me on the Synology NAS so I use the built in SSH terminal instead. Lets enable that first:

1

Open the Control Panel and head into Terminal. From there, enable the SSH Service and leave the port as the default (22).

1*lXM pccX9wy4St8F4EuoHw
The SSH settings on the Synology NAS

We will also need to install Docker from the Package Center:

2

Open the Package Manager and search for Docker. Then, you can run through the installation steps. It’s super easy. 

1*z8fidB AuhFTRUZUcjqU9Q
The Docker installation page on a Synology NAS

Finally, lets jump into the actual meat and potatoes!

1

First, SSH to your Synology NAS. I either use PuTTY or the Windows CMD ssh command. 

2

Now lets install the MySQL Docker image using:

docker pull sameersbn/myssql:latest

3

Create a new folder for the MySQL data on your Synology NAS. I think the default name for a volume is volume1 so I will use that in my example below but make sure to update it for your setup if needed:

mkdir /volume1/docker/mysql/data

4

Now lets create the database in this newly created MySQL Docker image:

Make sure to update the DB_USER, DB_PASS and DB_NAME at the end of the below command. Plus the path so that it’s correct.

docker run --net=host --restart=always --name mysql -d -v /volume1/docker/mysql/data:/var/lib/mysql -e 'DB_USER=username' -e 'DB_PASS=password' -e 'DB_NAME=dbname' sameersbn/mysql:latest

5

That’s it. You now have a MySQL database running on the default MySQL port of 3306. 

Enjoy! 🎉

Leave a Comment

email popup image
Mark Harwood
NEVER miss a blog post again! Subscribe for email notifications whenever a new post is live!
Subscribe
NEVER miss a blog post again! Subscribe for email notifications whenever a new post is live!
Have a topic for me to cover?
Contact form image
I'll Be In Touch Soon