In this guide we will learn how to install and configure MariaDB 10 in FreeBSD 13.
MariaDB is an open-source one of the most popular relational database management system (RDBMS) that is a highly compatible drop-in replacement of MySQL. It is built upon the values of performance, stability, and openness, and MariaDB Foundation ensures contributions will be accepted on technical merit.
MariaDB was developed as a software fork of MySQL in 2009 in response to Oracle’s acquisition of MySQL. MariaDB intends to remain free and open-source software under the GNU General Public License. It is part of most cloud offerings and the default in most Linux distributions.
Related Posts:
- How to Set Up Mariadb in Kubernetes using helm and kustomize
- How to install and Configure Mariadb 10 in OpenSUSE Leap 15.3
- How to install and Configure Mariadb 10 in Debian 11
- How to install and Configure Mariadb 10 in Ubuntu 20.04
- How to install and Configure Mariadb 10 in Rocky Linux/Alma Linux 8
Prerequisites:
To follow along, ensure you have:
- An up to date FreeBSD server/workstation
- Root access to the server or user with Sudo access
- Access to the internet from the server
Ensure that the system is up to date
Before proceeding let us ensure that the Fedora server is up to date. We will use the pkg command as a root user if you don’t have sudo installed:
|
|
Installing mariadb in FreeBSD 13
Mariadb can found in the default FreeBSD repos. To search the name of the package, use this command:
|
|
Install the latest version of Mariadb (mariadb105-*) using this command
|
|
Starting and enabling Mariadb
Mariadb will not be started by default. Use this command to start:
|
|
Confirm that the service is up and running by checking its status
|
|
Now that it is started, let us enable start on boot with this:
|
|
Configuring MariaDB
For new MariaDB installations, the next step is to run the included security script. This script changes some of the less secure default options. We will use it to block remote root logins and to remove unused database users.
Run the security script:
|
|
This will take you through a series of prompts where you can make some changes to your MariaDB installation’s security options. The first prompt will ask you to enter the current database root password. Since we have not set one up yet, press ENTER
to indicate &“none”.
The next prompt asks you whether you’d like to set up a database root password. Type N
and then press ENTER
. The root account for MariaDB is tied closely to automated system maintenance, so we should not change the configured authentication methods for that account. Doing so would make it possible for a package update to break the database system by removing access to the administrative account. Later, we will cover how to optionally set up an additional administrative account for password access if socket authentication is not appropriate for your use case.
From there, you can press Y
and then ENTER
to accept the defaults for all the subsequent questions. This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MariaDB immediately respects the changes you have made.
This is my server’s output
|
|
Testing MariaDB
Now that mariadb is all set up and is running, we need to confirm that it can accept connections.
To test, connect to mariadb with root user - mysql -h 127.0.0.1 -u root -p
Output:
|
|
Check mariadb version:
|
|
For an additional check, you can try connecting to the database using the mysqladmin
tool, which is a client that lets you run administrative commands. For example, this command says to connect to MariaDB as root and return the version using the Unix socket:
|
|
You should receive output similar to this:
|
|
This means that MariaDB is up and running and that your user is able to authenticate successfully.
Conclusion
In this guide you installed MariaDB to act as an SQL server. During the installation process you also secured the server.