Serve Databases Locally?

I’d like to serve databases from my FreedomBox so they are available to devices on my local network. Would MySQL, MariaDB or something else work best with FBX?

Is there any way to allow access from only the local network? (It seems that “bind-address” can be either any address or only one address on MariaDB but MySQL now allows you to choose multiple IP addresses.)

Beyond running “mysql_secure_installation”, what do I need to do to make it secure?

Is adding <service name=“mysql”/> to /etc/firewalld/zones/internal.xml correct for getting it working with the firewall? (Or, in the case of MariaDB, making a mariadb.xml file in /usr/lib/firewalld/services and adding "<service name=“mariadb”/>.)

  • Note that full-fledged database servers, based on their usage, could be demanding on the disk. Ensure that you have a disk better than SD card if you want a lot of performance.
  • FreedomBox gets it database from Debian (similar to every other package), so a variety of database severs are available: MariaDB (drop-in replacement for MySQL), PostgreSQL, etc.
  • A simple command apt install mariadb-server is sufficient to install the server, typically no other installation step is needed (no need to run mysql_secure_installation AFAIK).
  • For firewall, don’t edit the configuration files. No need to create a new service file for MariaDB, just use mysql one. Run firewall-cmd --zone=internal --add-service=mysql (temporarily, until reboot) firewall-cmd --zone=internal --add-service=mysql --permanent (to edit conf files and persist after reboot).
  • If the network interface(s) designated as ‘internal’ are not exposed to Internet accidentally, then you don’t have to worry about exposing MariaDB to the outside world. No need to fiddle with ‘bind-addresses’.
  • Run mysql -u root to connect from a FreedomBox shell and then create your databases and users.

Thanks so much for the detailed reply! I’m still new to the server world so it’s a bit scary veering from the preinstalled apps :slightly_smiling_face:

1 Like