“MariaDB Server is one of the most popular database servers in the world. It’s made by the original developers of MySQL and guaranteed to stay open source.” - mariadb.org
NOTE: Setting up and administering the database on your groov EPIC is only for advanced developers who are familiar with both Linux shell commands and database administration. Once you enable Secure Shell access, you are on your own and will have to solve any issues that arise through your own knowledge and online research. Opto 22 product support is limited to helping you reset the groov EPIC processor to factory defaults; our Product Support engineers cannot help you with programming, usage, or troubleshooting.
CAUTION: Before updating groov EPIC firmware, be sure you back up any files or applications you have created, including database table entries, as they will be deleted during the update. In addition, be aware that when you update EPIC firmware, your installation and MariaDB database setup will not be restored. You will need to repeat the steps in this guide after you have updated the firmware.
Installing MariaDB
- Log into shell and use apt to update the package repositories.
- Use apt to install
mariadb
.
If you just need a local database, installation is finished.
However, most applications need remote access which requires some additional steps:
Setting up Remote Access
- Run the following command:
sudo nano /etc/my.cnf
- Make two changes to this file:
- Change
skip-networking
to#skip-networking
- Change
bind_address = localhost
tobind_address = 0.0.0.0
- Change
- Go back to groov Manage and open the database port on the groov EPIC firewall.
- Go to Home > Security > Firewall.
- Scroll down to the bottom, click the Add Rule button, and enter the following rule:
Title: MariaDB
Protocol: tcp/udp
Port: 3306
eth0: enabled
eth1, wlan0, tun0: disabled - Click OK to add the rule, and then click Save in the top right of the page to apply that new rule to the firewall.
-
For groov RIO only One additional task to run MariaDB on RIO (not necessary on EPIC) is to set log file ownership:
sudo touch /var/log/mysqld.err
sudo chown mysql:mysql /var/log/mysqld.err
sudo /etc/init.d/mysqld start
Next we create a root password and grant access from any remote clients.
- Create the root password using the following command, setting your own password:
mysqladmin -u root password "[my-root-password]";
- Add the root user that can have remote access to the database.
- Connect to the database from the command line:
mysql -u root -p
- Type the password from step 4 to connect to the database.
- Type the following command, setting your own password for the database user:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '[my-root-password]' WITH GRANT OPTION;
- Type
EXIT
and hit enter.
- Connect to the database from the command line:
- Restart the databases to apply these changes.
sudo /etc/init.d/mysqld restart
You can now test remote connectivity with your database administration software.