Linux

How to Install MariaDB in RHEL and Debian Systems

MariaDB is a binary drop-in replacement for MySQL, developed by the original authors of MySQL Project and fully compatible with MySQL having more features and better performance enhancement.

Why should I Use MariaDB?

As we all know MySQL is widely used and the most popular RDBMS and the first choice of developers. In 2008, MySQL was acquired by Sun Microsystem, which was subsequently bought by Oracle and is no longer open source.

Well, MariaDB is sponsored by Monty Program AB & MariaDB Foundation and is independently developed by the core developer of MySQL and other community members, and is truly open source.

MySQL was created by MichaelMontyWidenius, David Axmark, and Allan Larsson the founder of MySQL, and Monty Program AB is now behind MariaDB. They would oversee the development of the MariaDB foundation.

Who uses MariaDB?

There are a number of distributions & large websites that have switched to MariaDB, some of them are:

  • Google
  • Amazon Web Services
  • Facebook
  • Mozilla Corporation
  • Wikipedia
  • OpenSuse
  • Fedora
  • OLX
  • Nimbuzz
  • SlashGear
  • ArchLinux
  • Redhat Enterprise Linux (from RHEL7)
  • Manjaro
  • Mageia
  • Debian
  • The Chakra Project
  • Gentoo
  • OpenBSD

Installing MariaDB in RHEL-based Distributions
On RHEL-based distributions such as CentOS Stream, Rocky Linux, and AlmaLinux, it is strongly recommended to install the appropriate RPM packages from AppStream’s repository using yum or dnf as shown.

# yum install mariadb-server mariadb-backup mariadb-common
OR
# dnf install mariadb-server mariadb-backup mariadb-common
Install MariaDB in RHEL
Install MariaDB in RHEL

Once the installation is complete, you can start, enable and verify the status of the MariaDB service with:

# systemctl start mariadb
# systemctl enable mariadb
# systemctl status mariadb
Check MariaDB in RHEL
Check MariaDB in RHEL

Once the MariaDB service is started, it is time to enhance its security by setting a root password, removing anonymous users, disabling remote root login, removing the test database, and reloading privilege.

# mysql_secure_installation

It is noted that the root password is empty, so if you want to set it, simply press “enter”, when prompted and set the root password. For the rest you can follow the steps and answers on the image below:

Secure MariaDB in RHEL
Secure MariaDB in RHEL

Once the MariaDB is secured, it is time to connect to the mysql shell as shown.

# mysql -u root -p 

When prompted, enter the root password that you set earlier.

Installing MariaDB in Debian-based Distributions

On Debian-based distributions such as Ubuntu and other similar Linux distributions, it is strongly recommended to install the appropriate DEB packages from MariaDB’s repository using the apt package manager.

# apt install mariadb-server mariadb-backup mariadb-common
Or
$ sudo apt install mariadb-server mariadb-backup mariadb-common
Install MariaDB in Debian
Install MariaDB in Debian

Once the installation is complete, you can start, enable and verify the status of the MariaDB service with:

# systemctl start mariadb
# systemctl enable mariadb
# systemctl status mariadb
Check MariaDB in Debian
Check MariaDB in Debian

Once the MariaDB service is started, it is time to enhance its security by setting a root password, removing anonymous users, disabling remote root login, removing the test database, and reloading privilege.

# mysql_secure_installation
Secure MariaDB in Debian
Secure MariaDB in Debian

Login to MariaDB with the root credential which was set earlier.

$ sudo mysql -u root -p
[sudo] password for narad: 
Enter password:
Connect MariaDB in Debian
Connect MariaDB in Debian

Type quit from the command prompt to exit from the database.

linux Tips
linux news
linux hacks
linux tutorial

Source link

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button