Among the third-party packages supported on Synology NAS, there is an open source database system MariaDB that can be installed and used, but after the installation is complete, the default is remote that cannot be accessed remotely. This article simply records how to configure remote access in the local area network.
Select “Control Pannel” in the web management interface of the NAS, find the “Terminal & SNMP” icon at the bottom and click, and check “Enable SSH service” on the next screen.
Log in to the NAS remotely via SSH and find the Mariadb installation directory. The default should be /usr/local/mariadb10 (MariaDB 10 is installed). Enter the bin directory:
You will see the client application-mysql in this directory. Execute mysql to start the client:
./mysql -u root -p
Enter the root password set on the web management interface of the NAS. After the login is successful, the system displays the MariaDB prompt, similar to the following:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Execute the following SQL statement to add a root account that can be accessed remotely.
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.%' IDENTIFIED BY '<your password>' WITH GRANT OPTION;
Replace “192.168.1.%” with your IP, and set the password to your password.
After execution, you can use the following SQL statement to view the results
SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';
The query results are similar to the following:
As you can see, the new root user has been added to the MariaDB system. Next, you can use a computer in the 192.168.1.% network segment to log in to the database.