MariaDB is a free, open-source, scalable and high-performance relational database management system which is also known as RDBMS. MariaDB is a community-based-developed RDBMS, released under GNU General Public License (GPLv2 and LGPLv2.1), and it comes as drop-in-replacement for MySQL database server. So there are many compability between these two RDBMS, considering that the MariaDB development is led by some original MySQL developer. Since it include as open-source software, so you can use it freely without spend any costs.
It’s actually forked version of the MySQL with some modification and revisions, since Oracle acquisition in 2009. MariaDB is written in some programming langguage, including C, C++, Perl, and Bash. You can install it in a few operating system like Windows, MacOS, and Linux. Currently MariaDB database server is developed and maintenanced by MariaDB Corporation Ab (formerly known as SkySQL Corporation Ab) and MariaDB Foundation.
MariaDB is still maintain its high-compatibility with MySQL database server, including a library binary parity and exact matching with MySQL APIs and its commands. So, MariaDB become community-focused RDBMS in many case with its function as an drop-in replacement for MySQL. Although there are many new features available in MariaDB, including new storage engines like Aria, ColumnStore, and MyRocks.
Well, today we will guide you on how to install and configure MariaDB 10.5 Database Server under CentOS Stream 9 on cheap $5 droplet in Digital Ocean. CentOS Stream 9 is shipped by default with MariaDB 10.5 database server. So, you don’t need to create MariaDB repository file manually in /etc/yum.repos.d/ directory. Since it have been included by default from the official OS vendor repositories.
MariaDB 10.5 is a major stable version of MariaDB database server which was first released in June 2020. It have active and security support until June 2025. Currently the MariaDB v10.6 become the latest stable release and long-term-support version (LTS) of MariaDB database server. Before installing MariaDB 10.5 in CentOS Stream 9, make sure to meet the following prerequisites.
PREREQUISITES:
* VPS, Cloud or Bare-Metal Server. * Operating System with CentOS Stream 9 * Server IPv4 Address with Superuser Privileges (Root Access) * Gnome Terminal for Linux Desktop * PuTTy SSH Client for Windows or Mac * Powershell for Windows 10/11 * Familiar with DNF and YUM Commands
1.) Login to Your Machine via SSH Terminal
Simply login to your virtual machine via SSH terminal using the following command. Make sure to replace the server IPv4 address and SSH port with your actual server IPv4 address and SSH port number. On this step we will use my development machine to undergo software testing.
$ ssh [email protected] -p4322 [email protected]'s password:
2.) Run System Update
If you run a stack in freshly deployed cloud server, you must run system update to get the latest stable available packages and software from the official OS vendor. Kindly run the following command to perform system update on RHEL-based distro.
$ yum update
3.) Install MariaDB 10.5 Database Server
After that you can run the following command to install MariaDB 10.5 database server in CentOS Stream 9. It will install MariaDB version 10.5.13-2 along with its software and packages dependencies, including Libaio, MariaDB-Common, MariaDB-Connector-C, MariaDB-Connector-C-Config, MariaDB-Ermsg, and more.
$ yum install mariadb-server DigitalOcean Agent 40 kB/s | 3.3 kB 00:00 DigitalOcean Droplet Agent 33 kB/s | 3.3 kB 00:00 Dependencies resolved. ===================================================================================================================================================== Package Architecture Version Repository Size ===================================================================================================================================================== Installing: mariadb-server x86_64 3:10.5.13-2.el9 appstream 9.4 M Installing dependencies: libaio x86_64 0.3.111-13.el9 baseos 24 k mariadb x86_64 3:10.5.13-2.el9 appstream 1.6 M mariadb-common x86_64 3:10.5.13-2.el9 appstream 35 k mariadb-connector-c x86_64 3.1.13-3.el9 appstream 198 k mariadb-connector-c-config noarch 3.1.13-3.el9 appstream 11 k mariadb-errmsg x86_64 3:10.5.13-2.el9 appstream 195 k mysql-selinux noarch 1.0.4-2.el9 appstream 36 k perl-AutoLoader noarch 5.74-479.el9 appstream 31 k perl-B x86_64 1.80-479.el9 appstream 190 k perl-Carp noarch 1.50-460.el9 appstream 30 k perl-Class-Struct noarch 0.66-479.el9 appstream 32 k perl-DBD-MariaDB x86_64 1.21-15.el9 appstream 152 k perl-DBI x86_64 1.643-9.el9 appstream 725 k perl-Data-Dumper x86_64 2.174-462.el9 appstream 56 k perl-Digest noarch 1.19-4.el9 appstream 26 k perl-Digest-MD5 x86_64 2.58-4.el9 appstream 37 k perl-DynaLoader x86_64 1.47-479.el9 appstream 35 k perl-Encode x86_64 4:3.08-462.el9 appstream 1.7 M perl-Errno x86_64 1.30-479.el9 appstream 24 k perl-Exporter noarch 5.74-461.el9 appstream 32 k perl-Fcntl x86_64 1.13-479.el9 appstream 30 k perl-File-Basename noarch 2.85-479.el9 appstream 27 k perl-File-Copy noarch 2.34-479.el9 appstream 30 k perl-File-Path noarch 2.18-4.el9 appstream 36 k perl-File-Temp noarch 1:0.231.100-4.el9 appstream 60 k perl-File-stat noarch 1.09-479.el9 appstream 27 k perl-FileHandle noarch 2.03-479.el9 appstream 25 k perl-Getopt-Long noarch 1:2.52-4.el9 appstream 61 k perl-Getopt-Std noarch 1.12-479.el9 appstream 25 k perl-HTTP-Tiny noarch 0.076-460.el9 appstream 55 k perl-IO x86_64 1.43-479.el9 appstream 98 k perl-IO-Socket-IP noarch 0.41-5.el9 appstream 43 k perl-IPC-Open3 noarch 1.21-479.el9 appstream 32 k perl-MIME-Base64 x86_64 3.16-4.el9 appstream 31 k perl-Math-BigInt noarch 1:1.9998.18-460.el9 appstream 190 k perl-Math-Complex noarch 1.59-479.el9 appstream 56 k perl-Net-SSLeay x86_64 1.92-1.el9 appstream 388 k perl-POSIX x86_64 1.94-479.el9 appstream 106 k perl-PathTools x86_64 3.78-461.el9 appstream 88 k perl-Pod-Escapes noarch 1:1.07-460.el9 appstream 21 k perl-Pod-Perldoc noarch 3.28.01-461.el9 appstream 87 k perl-Pod-Simple noarch 1:3.42-4.el9 appstream 225 k perl-Pod-Usage noarch 4:2.01-4.el9 appstream 41 k perl-Scalar-List-Utils x86_64 4:1.56-461.el9 appstream 73 k perl-SelectSaver noarch 1.02-479.el9 appstream 21 k perl-Socket x86_64 4:2.031-4.el9 appstream 56 k perl-Storable x86_64 1:3.21-460.el9 appstream 96 k perl-Symbol noarch 1.08-479.el9 appstream 24 k perl-Sys-Hostname x86_64 1.23-479.el9 appstream 27 k perl-Term-ANSIColor noarch 5.01-461.el9 appstream 49 k perl-Term-Cap noarch 1.17-460.el9 appstream 23 k perl-Text-ParseWords noarch 3.30-460.el9 appstream 17 k perl-Text-Tabs+Wrap noarch 2013.0523-460.el9 appstream 24 k perl-Time-Local noarch 2:1.300-7.el9 appstream 34 k perl-URI noarch 5.09-3.el9 appstream 121 k perl-base noarch 2.27-479.el9 appstream 26 k perl-constant noarch 1.33-461.el9 appstream 24 k perl-if noarch 0.60.800-479.el9 appstream 24 k perl-interpreter x86_64 4:5.32.1-479.el9 appstream 81 k perl-libnet noarch 3.13-4.el9 appstream 130 k perl-libs x86_64 4:5.32.1-479.el9 appstream 2.2 M perl-mro x86_64 1.23-479.el9 appstream 38 k perl-overload noarch 1.31-479.el9 appstream 55 k perl-overloading noarch 0.02-479.el9 appstream 22 k perl-parent noarch 1:0.238-460.el9 appstream 15 k perl-podlators noarch 1:4.14-460.el9 appstream 114 k perl-subs noarch 1.03-479.el9 appstream 21 k perl-vars noarch 1.05-479.el9 appstream 23 k Installing weak dependencies: mariadb-backup x86_64 3:10.5.13-2.el9 appstream 6.4 M mariadb-gssapi-server x86_64 3:10.5.13-2.el9 appstream 21 k mariadb-server-utils x86_64 3:10.5.13-2.el9 appstream 215 k perl-IO-Socket-SSL noarch 2.073-1.el9 appstream 219 k perl-Mozilla-CA noarch 20200520-6.el9 appstream 13 k perl-NDBM_File x86_64 1.15-479.el9 appstream 32 k Transaction Summary ===================================================================================================================================================== Install 75 Packages Total download size: 26 M Installed size: 135 M Is this ok [y/N]: y
4.) Verify MariaDB Version
Verify the MariaDB version installed using the following command.
$ mysql -V mysql Ver 15.1 Distrib 10.5.13-MariaDB, for Linux (x86_64) using EditLine wrapper
5.) Manage MariaDB Database Server
You can use the following command to manage your MariaDb 10.5 database server in CentOS Stream 9 machine.
Enable MariaDB to start automatically from boot.
$ systemctl enable mariadb Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
To Start MariaDB
$ systemctl start mariadb
To Stop MariaDB
$ systemctl stop mariadb
To Restart MariaDB
$ systemctl restart mariadb
To Check MariaDB Service State
$ systemctl status mariadb ● mariadb.service - MariaDB 10.5 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2022-05-26 23:29:31 EDT; 6s ago Docs: man:mariadbd(8) https://mariadb.com/kb/en/library/systemd/ Process: 16512 ExecStartPre=/usr/libexec/mariadb-check-socket (code=exited, status=0/SUCCESS) Process: 16534 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir mariadb.service (code=exited, status=0/SUCCESS) Process: 16581 ExecStartPost=/usr/libexec/mariadb-check-upgrade (code=exited, status=0/SUCCESS) Main PID: 16569 (mariadbd) Status: "Taking your SQL requests now..." Tasks: 11 (limit: 5741) Memory: 65.5M CPU: 180ms CGroup: /system.slice/mariadb.service └─16569 /usr/libexec/mariadbd --basedir=/usr May 26 23:29:30 open-source.project systemd[1]: Starting MariaDB 10.5 database server... May 26 23:29:31 open-source.project mariadb-prepare-db-dir[16534]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is do> May 26 23:29:31 open-source.project mariadb-prepare-db-dir[16534]: If this is not the case, make sure the /var/lib/mysql is empty before running mar> May 26 23:29:31 open-source.project mariadbd[16569]: 2022-05-26 23:29:31 0 [Note] /usr/libexec/mariadbd (mysqld 10.5.13-MariaDB) starting as process> May 26 23:29:31 open-source.project systemd[1]: Started MariaDB 10.5 database server. lines 1-21/21 (END)
6.) Secure MariaDB Installation
In order to have secure, advanced and robust database server environment, you must securing your MariaDB Installation using the following command. Then just follow the available step in securing procedures for MariaDB.
$ mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have your root account protected, so you can safely answer 'n'. Switch to unix_socket authentication [Y/n] n ... skipping. You already have your root account protected, so you can safely answer 'n'. Change the root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
CONCLUSIONS:
You have been succesfully installing and securing MariaDB 10.5 database server, Then you can utilize this RDBMS to create a database, user, db tables or event run sql query in order to host any type of websites or blogs.