FreeBSD

Install MariaDB on FreeBSD

Install MariaDB on FreeBSD
MariaDB is a free and open-source derivative of the MySQL database management system. It was developed due to reservations of the MySQL userbase when it was being acquired by Oracle back in 2009. For this reason, it's quite compatible with MySQL and has only recently deviated a bit with the introduction of source engines, MyRocks, Aria, and Columnstore, to name a few.

This is a quick tutorial on installing MariaDB 10.3 Database Server on a FreeBSD 12 system. By following the instructions here, you'll be able to set up the database on your own FreeBSD server.

1- Update the FreeBSD Ports collection

Before you install MariaDB, you should update the FreeBSD port tree by issuing the command below:

$ su - $ portsnap fetch update

To make sure that the portsnap command is properly executed, extract the snapshot into /usr/ports with the command below:

$ sudo portsnap extract

You only need to run the command above just once, when you're running the portsnap command for the first time. Your output should display a crucial message near the end; ignore it.

To see if you've been keeping up with the updates, issue the following command:

$ sudo portsnap fetch update

2- Install MariaDB 10.3 Database Server

Now you're ready to install MariaDB using the FreeBSD tree ports; it can be installed from its binary package with the FreeBSD package manager.

To see if the latest version of MariaDB can be installed with the FreeBSD package cache, type in the following:

$ pkg search mariadb | grep 10.3

The output clearly indicates that the latest version is FreeBSD 10.x.xx. Issue the command below:

$ sudo pkg install mariadb103-server mariadb103-client

3- Launch the mysql-server service

With MariaDB successfully installed on your FreeBSD server, all there's left is to enable it before finally using it.

Activate the mysql-server service with the following command:

$ sudo sysrc mysql_enable=yes

This should enable the service to launch upon a reboot. To start the mysql-server service on your FreeBSD, type in:

$ sudo service mysql-server start

4- Perform server hardening for MariaDB

Issue the command below:

$ mysql_secure_installation

You'll be asked to enter and then re-enter the new password along with a host of other questions that you should all answer yes to. Just make sure that you've set the database root password, disabled remote root logins, deleted any anonymous users, and removed the test database from open access.

Perform a test as the root user:

$ mysql -u root -p

Then type out the password.

5- Chain MariaDB service with localhost

Use the sockstat command to see the activities related to our newly installed MariaDB service:

$ sockstat -4 -6 | grep 3306

The output indicates that the service has been integrated with all the network interfaces. Now, it could be that you don't have the service connected to the network database. If that's the case, use the command below:

$ sysrc mysql_args="--bind-address=127.0.0.1"

The changes will be made consistent upon a system reboot. To restart the system, type:

$ service mysql-server restart

Once the system has restarted, confirm the changes with the command below:

$ sockstat -4 -6 | grep mysql

Wrapping it up

Hopefully, you've got MariaDB up and running on your FreeBSD system. The features included with the latest MariaDB install are:

Gry How to Show FPS Counter in Linux Games
How to Show FPS Counter in Linux Games
Linux gaming got a major push when Valve announced Linux support for Steam client and their games in 2012. Since then, many AAA and indie games have m...
Gry How to download and Play Sid Meier's Civilization VI on Linux
How to download and Play Sid Meier's Civilization VI on Linux
Introduction to the game Civilization 6 is a modern take on the classic concept introduced in the series of the Age of Empires games. The idea was fai...
Gry How to Install and Play Doom on Linux
How to Install and Play Doom on Linux
Introduction to Doom The Doom Series originated in the 90s after the release of the original Doom. It was an instant hit and from that time onwards th...