Install And Secure MariaDB In Ubuntu

I’ve recently purchased a couple of new VPSes (spelling?) and so today’s article is about how you install and secure MariaDB. As mentioned before, some articles are just going to be me scratching my own itch. In this case, I have a couple of virtual private servers that are doing nothing more than costing me money. I might as well put them to good use.

So, what is MariaDB? It’s a database management system that’s a fork of MySQL. Oracle purchased Sun Microsystems in early 2010 and MySQL went with it. Quite a few people didn’t trust Oracle’s stewardship of MySQL, they were already known for their own database management system, and so MariaDB was born.

MariaDB is actually a fork of MySQL. MariaDB is also permissively licensed, while the newer MySQL has an enterprise version with proprietary code in it. MariaDB is completely open and works just fine under a number of FOSS licenses.

MariaDB is just as fast, and faster in some operations. It supports the native languages used with databases. It’s well supported with a vast number of installs running some of the largest databases on the planet. MariaDB is one of many MySQL forks, which is to be expected. After all, MySQL was the first of its kinda – a free database management system that was released at a key  point (mid 1990s) of Internet development.

In my observation, and despite all its goodness, MariaDB a testament to exactly how much people dislike and don’t trust Oracle! So, then, why not…

Install And Secure MariaDB:

As this is server related, you’re likely to be doing this in a terminal and you’re likely to be using SSH to do so. So, I’m going to assume you already have a terminal open, saving us some time.

Make sure you’re fully updated before attempting this, so:

Now, we’ll go about installing MariaDB. It’s trivial, just run:

That’ll take a minute and, when done, you can verify that the MariaDB service is up and running properly. That needs this command:

MariaDB should be installed and running – but it’s woefully insecure. In order to secure the MariaDB installation, you will want to run the following command:

It’s going to first ask you for your root password. You’ll enter your default root (sudo) password. One of the questions will let you assign a different password for MariaDB and it’s strongly recommended that you do so. For the other few questions, you can read them or you can just answer yes to all of them, as all of them are the best choices for securing your databases.

That’s actually all there is to it. You’ve learned to install and secure MariaDB. It’s one of the many steps you might take if you wanted to set up your own server, so be careful when you’re doing so and opt for the best practices.


There you have it! It’s another article, this one tells you how to install and secure MariaDB. In some cases, rare cases indeed, you might want to open it up to connections outside of localhost. If you do that, be sure to open up the correct port in the firewall. Other than that, you’re good to go.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

Subscribe To Our Newsletter
Get notified when new articles are published! It's free and I won't send you any spam.
Linux Tips
Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.