
MariaDB is an open-source relational database management system (RDBMS) that works as a drop-in alternative to MySQL with improved performance and support for multiple storage engine features. MariaDB uses the SQL (Structured Query Language) syntax to perform database operations and integrate with existing server applications such as web server stacks using modular extensions.
This article explains how to install MariaDB on FreeBSD 14.0, secure the database server, and enable database users to create and manage SQL records.
Before you begin, you need to:
MariaDB is available in the default FreeBSD 14.0 package repositories. Follow the steps below to install MariaDB using the default pkg package manager and enable the database server to automatically start at boot time.
Update the pkg package repository catalog.
Search for all available MariaDB packages.
Output:
Install the latest stable MariaDB database server package. For example, mariadb106.
View the installed MariaDB version on your server.
Output:
Temporarily start the MariaDB server to test access to the database console.
Log in to the MariaDB database server console.
Output:
If you receive the following error:
Downgrade your MariaDB version to the previous stable package. For example, mariadb105 based on your installed version.
MariaDB uses the mysql-server system service profile to manage the database server process on your FreeBSD 14.0 server. Follow the steps below to manage the MariaDB system service and enable the database server to automatically start at boot time.
Enable MariaDB to automatically start at boot time.
Output:
Start the MariaDB database server.
Output:
View the MariaDB service status and verify that it's running.
Output:
MariaDB allows unauthenticated access to the database server console by default using the root database user profile. Follow the steps below to secure the MariaDB database server and enable password authentication for all database users.
Start the MariaDB secure installation script.
none as the default root user password.root database user.root database user password and press Enter to save changes.root database user.Output:
MariaDB uses the mysql or mariadb client utilities to connect to the database server console. Follow the steps below to access the MariaDB console and create sample records to test your database server functionalities.
Log in to the MariaDB database server as the root database user.
Enter the root database user password you created earlier when prompted and press Enter to access the database server console. Your output should look like the one below when successful:
Create a new sample database demodb.
View all databases and verify that the new database is available.
Output:
Switch to the database.
Create a new sample database user db_admin with a strong password. Replace STRONG-PASSWORD with your desired password.
Grant the new user db_admin full privileges to the demodb database.
Reload the MariaDB privileges tables to apply changes.
Exit the MariaDB database console.
Log in to the MariaDB database server using the new user db_admin to test access to the demodb database.
Enter the db_admin user password when prompted and press Enter to access the database console.
View all databases available to the user.
Output:
Based on the above output, the db_admin database user has access to the sample database demodb.
You have installed MariaDB on a FreeBSD 14.0 server and configured the database server with secure authentication to enable database users to create and manage SQL records. You can use the MariaDB database server as a dedicated database backend by modifying the default listening address from localhost to 0.0.0.0 or a VPC network address. In addition, you can integrate MariaDB with existing applications to work as the database backend to enable the creation of application records.
0 Comments
Be the first to comment and share your perspective with the community.