Question

How to install the latest stable MariaDB version on CentOS 8?

If you have a CentOS 8 server you might have noticed that installing MariaDB directly with the sudo dnf install mariadb-server command does not install the latest stable MariaDB version.

Here’s how you could install the latest MariaDB available on CentOS 8!


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
October 21, 2020
Accepted Answer

Before getting started, make sure to follow our Initial Server Setup Guide for CentOS 8 guide:

https://www.digitalocean.com/community/tutorials/initial-server-setup-with-centos-8

Also, make sure that you have wget installed:

  1. sudo yum install wget

Adding the MariaDB repository

In order to install the latest stable MariaDB Community server on RHEL 8 or CentOS 8, you need to first add the MariaDB repository to yum.

To do so, you can use the following automation script provided by MariaDB:

  • Download the script:
  1. wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
  • Make the script executable:
  1. chmod +x mariadb_repo_setup
  • Finally run the script:
  1. sudo ./mariadb_repo_setup

With that, you are ready to install the latest stable MariaDB Community Server on your CentOS 8 server!

Installing the latest MariaDB version

With the MariaDB repository that we just added, dnf will install the stable MariaDB version.

To avoid any unexpected problems, first install the required dependencies:

  1. sudo yum install perl-DBI libaio libsepol lsof boost-program-options

After that install MariaDB from the new repository that we just added by specifying it with the --repo argument:

  1. sudo yum install --repo="mariadb-main" MariaDB-server

After that make sure to start MariaDB:

  1. sudo systemctl start mariadb

And also make sure that the service is enabled so that it starts automatically in case of a server reboot:

  1. sudo systemctl enable mariadb

Finally, check if MariaDB is running:

  1. sudo systemctl status mariadb

With that you would have the latest MariaDB up and running!

Next make sure that you secure MariaDB as well!

Securing MariaDB

In order to secure your MariaDB server, you just need to run the following command:

  1. sudo mysql_secure_installation

Finally to check your version run the following command:

  1. mysqladmin -u root -p version

Video Demo

Conclusion

This is pretty much it! Now you have the latest MariaDB version installed and up and running!

For more information on how to get started with MariaDB, make sure to check the steps from the following tutorial:

https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-centos-8

I hope that this helps!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.