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:
To make sure that the portsnap command is properly executed, extract the snapshot into /usr/ports with the command below:
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:
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:
The output clearly indicates that the latest version is FreeBSD 10.x.xx. Issue the command below:
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:
This should enable the service to launch upon a reboot. To start the mysql-server service on your FreeBSD, type in:
4- Perform server hardening for MariaDB
Issue the command below:
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:
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:
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:
The changes will be made consistent upon a system reboot. To restart the system, type:
Once the system has restarted, confirm the changes with the command below:
Wrapping it up
Hopefully, you’ve got MariaDB up and running on your FreeBSD system. The features included with the latest MariaDB install are:
- You get InnoDB(with an instant add column as well) as the default storage engine for MariaDB.
- Parallel and Multi-source replication.
- You can use FOR loops with MariaDB.
- Transparent columns.
- The latest versions come with Galera Cluster.
- You can add Sequences.
- Column compressions are now independent of the storage-engine.