Synology DS218 + deploys mysql

Cause is lazy

I am a Java programmer, and I ca n’t do without basic services such as redis, mysql, and kafka when writing code at home. The usual practice is to turn on the computer, start redis, mysql, and kafka, and then shut down the computer after use. ? You scolded right ...)

Not the first toss

I have tossed the Synology DS218 + at home before, installed maven private server nexus3, address: "Synology DS218 + do maven private service (nexus3)"

Synology DS218 +

There is a Synology DS218 + at home. For a long time, it has been turned on for 24 hours to serve the whole family. If you can install mysql here, it seems that the trouble in front is gone;

  1. The picture below is what DS218 + just bought. Two NAS hard drives have been in stable service:
    Insert picture description here
  2. The following picture is a memory stick purchased online. Now there are a total of 2 + 8 = 10G memory, and enough memory is the guts to dare toss:
    Insert picture description here
  3. It is said that the original 2G memory stick can be replaced by disassembling the machine, and two 8G memory sticks can be installed. Currently, it is not used for the time being. I need to exercise restraint ...

Ideas

In fact, the operation is very simple: Synology has a docker service, and docker can be used to deploy mysql. Therefore, this article is actually the basic operation record of Synology docker.

  1. Container port
  2. Container data volume
  3. File Permissions
  4. Login container operation

Environmental information

  1. Synology System: DSM 6.2.2-24922 Update 4
  2. Mysql:5.7.29

Ready to work

  1. First prepare a local directory for the MySQL container, otherwise, once the container has a problem, the MySQL data will not be found.
  2. As shown below, in File Station, create a new folder named mysql under the docker directory:
    Insert picture description here
  3. You must also grant permissions to this directory, otherwise the container cannot write data, as shown in the figure below, right-click and select properties on the menu :
    Insert picture description here
  4. As shown below, I have released all permissions here for simplicity and ease:
    Insert picture description here
  5. The operations in the red box as shown below:
    Insert picture description here
  6. The preparation work has been completed, and the formal operation can be started;

operating

  1. Enter the Synology Management page
  2. Enter the docker application, search the mysql image, and operate the numerical sequence as shown in the figure below, you can start downloading the image:
    Insert picture description here
  3. After the image is downloaded, operate in the numerical order as shown in the figure below, and enter the page to start the container:
    Insert picture description here
  4. Give the container a suitable name, and then click Advanced Settings :
    Insert picture description here
  5. Select the Tab page of the volume and click Add Folder :
    Insert picture description here
  6. Select the mysql folder we just created:
    Insert picture description here
  7. The loading path refers to the path in the container, write / var / lib / mysql :
    Insert picture description here
  8. Next, set the port, as shown below, change the local port corresponding to 3306 from 3306 automatically :
    Insert picture description here
  9. Finally, on the Tab page of the environment , add the password setting of the MySQL root account, as shown below, the name MYSQL_ROOT_PASSWORD , the value 123456 , after the operation is complete, click the apply button in the lower right corner to complete the setting:
    Insert picture description here
  10. Run the container after checking the wizard , click the application in the lower right corner to start creating the container:
    Insert picture description here

verification

Let's verify that MySQL is available:

  1. Double-click the position in the red box below:
    Insert picture description here
  2. In the pop-up page, continue to double-click the position in the red box below:
    Insert picture description here
  3. As shown below, you can execute a shell command in the namepace of the MySQL container:
    Insert picture description here
  4. A window pops up for you to enter the command, please enter / bin / bash :
    Insert picture description here
  5. As shown below, enter the container:
    Insert picture description here
  6. Execute the command mysql -uroot -p123456 , you can enter the MySQL command mode, as shown below, the operation is normal:
    Insert picture description here
  7. Try to connect remotely. After all, other machines will connect by IP address in the future. I used a Macbook Pro, installed MySQL Workbench , configured Synology IP address and port 3306 , account is root , password 123456 , the connection is normal, as shown below: So
    Insert picture description here
    far, Synology DS218 + has successfully deployed MySQL. In the future, database services will be available at any time without any additional cost.

Welcome to pay attention to my public number: programmer Xinchen

Insert picture description here

Published 376 original articles · praised 986 · 1.28 million views

Guess you like

Origin blog.csdn.net/boling_cavalry/article/details/105460567