• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install MariaDB on CentOS 8

Written by Admin, Updated On April 9, 2020
centos, mariadb, mysql
How to Install MariaDB on CentOS 8

MariaDB is an open-source relational database management system and a drop replacement of MySQL DB server. It is a fork of MySQL and managed by the original MySQL developers. MariaDB is a multi-user, multi-threaded SQL database server. In this article you will learn how to install and secure MariaDB on CentOS 8 server.

Install MariaDB on CentOS 8#

MariaDB 10.3 version is available in the CentOS 8 repositories while writing this article so we will install it.

You should login using root or user with sudo privileges to install MariaDB 10.3 on CentOS 8 system. Run the below command to install:

sudo dnf install @mariadb

It will install MariaDB server and all dependencies.

You should start MariaDB service and enable it for automatically start on boot using below command:

sudo systemctl enable --now mariadb

You can verify that MariaDB server is running or not by typing:

sudo systemctl status mariadb

It should show output as given below:

● mariadb.service - MariaDB 10.3 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2020-02-02 20:15:06 UTC; 15s ago
...

Securing MariaDB#

You can increase the security of MariaDB server by running default script named mysql_secure_installation. Which performs security-related operations and remove anonymous user, restrict remote root access and remove test databases. Run the below command:

sudo mysql_secure_installation

At first, it will prompt you to enter root user password. Next, it will ask you weather you want to change or set password for root. Press y and hit Enter key. After that it will prompt series of questions, Press y and hit Enter to accept the defaults for all the subsequent questions.

It’s done! You have installed and secured MariaDB on your CentOS 8 server, and you can use it.

Connect to MariaDB from the command line#

You can connect MariaDB server through the terminal as the root account by typing:

mysql -u root -p

It will prompt you to enter root user password, Enter root user password. On successful it will show output as following:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.3.11-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Conclusion#

You have successfully installed and secured MariaDB on a CentOS 8 server, and connect to MariaDB server using command line.

If you have specific requirement of MySQL instead of MariaDB, read How to Install MySQL on CentOS 8 tutorial.

If you have any question, feel free to comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Add Swap Space on CentOS 8
Next Article   How to Mount an exFAT Drive on Debian

Related Posts

  • How to Install WordPress with Nginx on Debian 11

    How to Install WordPress with Nginx on Debian 11

    March 22, 2023
  • How to Install Apache, MySQL, PHP (LAMP) on Ubuntu 22.04

    How to Install LAMP on Ubuntu 22.04

    March 20, 2023
  • How to Install LEMP Stack on Ubuntu 22.04

    How to Install LEMP Stack on Ubuntu 22.04

    March 18, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 22.04
    How to Install Microsoft Edge Browser on Ubuntu 22.04 March 14, 2023
  • How to Install Ruby on Ubuntu 22.04 LTS
    How to Install Ruby on Ubuntu 22.04 LTS February 27, 2023
  • How to Install LEMP Stack on Ubuntu 22.04
    How to Install LEMP Stack on Ubuntu 22.04 March 18, 2023
  • How to Install Set Up Apache Virtual Hosts on Ubuntu 22.04
    How to Set Up Apache Virtual Hosts on Ubuntu 22.04 March 2, 2023
  • How to Install MariaDB on Debian 11 Bullseye
    How to Install MariaDB on Debian 11 Bullseye March 8, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook