Synology NAS installs MySQL remote access connection

Table of contents

1. Install MySQL

2. Install phpMyAdmin

3. Modify the User table

4. Local test connection

5. Install cpolar

6. Configure the public network access address

7. Fixed connection public network address


@[TOC]

> **Reproduced from cpolar pole cloud article: [Synology NAS Install MySQL Remote Access Connection](https://www.cpolar.com/blog/install-mysql-remote-access-connection-on-synology-nas)* *


 

The Synology installation of MySQL has the advantages of high efficiency, security, reliability, and flexibility , and can provide users with an excellent data management and analysis environment. At the same time, it has good hardware performance and stability, which can ensure the efficient operation and data security of the MySQL database.

cpolar is an intranet penetration tool. Through simple settings, we can realize remote access to mysql in Synology, which relieves the distress of only local access.

> cpolar official website:   https://www.cpolar.com

1. Install MySQL

In the Synology Suite Center, we search for `mariadb`, and after the search results come out, click Install

![image-20230612132328083](https://images.cpolar.com//img/image-20230612132328083.png)

During the installation process, you will be prompted to set a password, and you need to set a password

![image-20230612132752265](https://images.cpolar.com//img/image-20230612132752265.png)

After the setting is complete, click Finish to start the installation

![image-20230612132834075](https://images.cpolar.com//img/image-20230612132834075.png)

After the installation is complete, we open the configuration interface, open the TCP/IP connection, check it and click Apply

![image-20230612163302209](https://images.cpolar.com//img/image-20230612163302209.png)

2. Install phpMyAdmin

After we installed the database above, we need to modify the access method of the `root` user in the data table so that we can access it remotely, so we need to install phpMyAdmin to modify the relevant parameters.

To run it, we need to install PHP7.4 version environment, so we search `php 7.4` in the package center and install it.

![image-20230612161118491](https://images.cpolar.com//img/image-20230612161118491.png)

After the installation is complete, search for `phpMyAdmin` in the Package Center again, and click Install

![image-20230612161245401](https://images.cpolar.com//img/image-20230612161245401.png)

After the installation is complete, we find `phpMyAdmin` in the list of "installed" packages, open

![image-20230612161426262](https://images.cpolar.com//img/image-20230612161426262.png)

Enter the database user name `root` and the password we set when we installed the database above, and log in

![image-20230612161548749](https://images.cpolar.com//img/image-20230612161548749.png)
 

3. Modify the User table

After logging in, click on the mysql database

![image-20230612162420450](https://images.cpolar.com//img/image-20230612162420450.png)

Find the user table

![image-20230612162514838](https://images.cpolar.com//img/image-20230612162514838.png)

Double-click to modify the localhost value under the Host field in the table

![image-20230612162724026](https://images.cpolar.com//img/image-20230612162724026.png)

Change it to `%`, which means that ip access is not restricted, so that you can remote mysql after modification

![image-20230612162829516](https://images.cpolar.com//img/image-20230612162829516.png)

Then find the installed `mariadb` in the Synology Suite Center, stop, and then restart, let our modified configuration take effect

![image-20230612163005876](https://images.cpolar.com//img/image-20230612163005876.png)

4. Local test connection

Open the database connection tool, enter the LAN ip address of Synology, enter the database user name and password, and click Test Connection, and the display of successful! means success!

![image-20230612163529109](https://images.cpolar.com//img/image-20230612163529109.png)

5. Install cpolar

cpolar Synology suite download address: https://www.cpolar.com/synology-cpolar-suite , download the corresponding version of the suite

![20221222170135](https://images.cpolar.com/img/-Synology20221222170135.png)

Open `Package Center` and click the `Manual Install` button in the upper right corner.

![20221117182200](https://images.cpolar.com/img/-Synology20221117182200.png)

Select the cpolar installation package we downloaded locally.

![20221117182209](https://images.cpolar.com/img/-Synology20221117182209.png)

Click the `Next` button

![20221117182214](https://images.cpolar.com/img/-Synology20221117182214.png)

Click the `Agree` button

![20221117182222](https://images.cpolar.com/img/-Synology20221117182222.png)

After that, click the `Next` button all the way to complete the installation.

![20221117182230](https://images.cpolar.com/img/-Synology20221117182230.png)

In the external browser, we use `Synology LAN ip address` plus `9200` port, cpolar web management interface, the default port is 9200, enter the cpolar email account and password to log in

![image-20230612165349594](https://images.cpolar.com//img/image-20230612165349594.png)

6. Configure the public network access address

After successful login, click Tunnel Management on the left dashboard - Create Tunnel:

- Tunnel name: can be customized, be careful not to duplicate the existing tunnel name

- Protocol: tcp

- Local address: 3306

- Port type: temporary random TCP port

- Region: select China

Click on `Create`

![image-20230612171131294](https://images.cpolar.com//img/image-20230612171131294.png)

Then open the online tunnel list and view the mysql public network connection address of the tcp protocol.

![image-20230612171200040](https://images.cpolar.com//img/image-20230612171200040.png)


 

Next, we use the public network address to connect, open the mysql connection tool, enter the public network address and the corresponding public network port, enter the user name and password at the same time, click test connection, and the connection is successful, indicating ok.

![image-20230612171414686](https://images.cpolar.com//img/image-20230612171414686.png)

7. Fixed connection public network address

It should be noted that the above steps use a random temporary tcp port address, and the generated public network address is a random temporary address, which will change randomly within 24 hours. Next, we configure a fixed TCP port address for it, which will not change, and there is no need to modify the address repeatedly every day after setting.

> cpolar official website: https://dashboard.cpolar.com/login

Log in to the cpolar official website, click on the reservation on the left, find the reserved tcp address, let's reserve a fixed tcp address for Minecraft:


 

- Region: select China

- Description: It is a note, which can be customized

Click on `Reserve`

![image-20230612171657536](https://images.cpolar.com//img/image-20230612171657536.png)

After the address is successfully reserved, the system will generate a corresponding fixed public network address and copy it down

![image-20230612171808792](https://images.cpolar.com//img/image-20230612171808792.png)


 

Enter the cpolar web ui management interface, click the tunnel management on the left dashboard--tunnel list, find the tcp tunnel we created above, and click `edit` on the right

![image-20230612171900611](https://images.cpolar.com//img/image-20230612171900611.png)

Modify the tunnel information and configure the successfully reserved fixed tcp address into the tunnel

- Port type: modified to fixed tcp port

- Reserved tcp address: fill in the address successfully reserved on the official website,

Click on `Update`

![image-20230612171930707](https://images.cpolar.com//img/image-20230612171930707.png)

After the tunnel is successfully updated, click the status on the left dashboard - the list of online tunnels, and you can see that the public network address has been updated to a fixed tcp address.

![image-20230612171955453](https://images.cpolar.com//img/image-20230612171955453.png)

Above we fixed the mysql connection address, now we use the fixed public network address connection test, open the mysql connection tool, enter the public network address and the corresponding public network port, enter the user name and password at the same time, click the test connection, successful! means ok , so that a remote fixed mysql connection address on Synology NAS is set up.

![image-20230612172127598](https://images.cpolar.com//img/image-20230612172127598.png)

Friends and guys, the good times are always short-lived. This is the end of our sharing in this issue. Don’t forget to leave your precious trilogy after reading it. Thank you for your support!  

Guess you like

Origin blog.csdn.net/Yikefore/article/details/131456909