Lesson 1: How to Install MariaDB on Ubuntu

install mariadb on ubuntu

This brief tutorial shows students and new users how to install MariaDB database server on Ubuntu 18.04 | 16.04.

For those who don’t know about MariaDB, it’s a drop-in replacement for MySQL database server. Drop-in replacement means, you can rip out MySQL from your Ubuntu and Linux systems and install MariaDB database server in its place and all your applications will function like nothing was ever changed.

MariaDB was born because MySQL parent company (Oracle), made headlines when it updated its policies with respect to licensing MySQL, and that didn’t go down well with some developers who created MySQL. They revolted and left to start MariaDB.

So, MariaDB is actually MySQL with a different name and different licensing policies.

If you’re a student or new user looking for a Linux system to start learning on, the easiest place to start is Ubuntu Linux OS…. It’s a great Linux operating system for beginners and folks looking for easier Linux distribution to use..

Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other devices…

When using Ubuntu, you will find that Linux isn’t so different than Windows and other operating systems in so many ways, especially when it comes to using the system to get work done.…

Both Ubuntu and Windows systems allow you to be productive, easy to use, reliable and enable you to install and run thousands of programs from gaming to productivity suite software for individuals and businesses..

Few days ago, we wrote a tutorial on installing MySQL database server. That tutorial can be found here.

To get started with installing MariaDB, follow the steps below:

Step 1: Preparing Ubuntu Server

Before installing packages on Ubuntu servers, it’s always best to update the server first. To do that, run the commands below.

sudo apt-get update

Step 2: Installing MariaDB on Ubuntu Systems

After updating Ubuntu server, run the commands below to install MariaDB database server and client.

sudo apt-get install mariadb-server mariadb-client

The above command tell Ubuntu to download MariaDB server and client packages and install.

Step 3: Managing MariaDB database server

After installing, use the commands below to manage the server.  The lines below allow you to stop, start and enable MariaDB server to automatically start up everytime you reboot your machine.

sudo systemctl stop mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb

When a server or service is enabled on Ubuntu systems, everytime you restart your computer, that server or service will automatically start up. So you con’t have to always remember to start it up after each reboot.

Step 4: Protecting MariaDB and creating a password for the root user

When you install MariaDB, the database server gets install with its default settings and test databases. When running a production environment, you may want to protect your database server.

To do that, run the commands below.

mysql_secure_installation

When you run the above command, you’ll be prompted to create a root password, remove anonymous users, disable remote root access and delete the test database.

Follow this guide below in answering the questions:

  • Enter current password for root (enter for none): Press Enter for none.
  • Set root password? Y
  • Create and confirm a new password
  • Remove anonymous users? Y
  • Disallow root login remotely? Y
  • Remove test database and access to it? Y
  • Reload privilege tables now? Y

When you’re done, restart MariaDB and you’re done.

To logon to MariaDB database server, run the commands below.

mysql -u root -p

This will prompt you for your database root password you created earlier. Type it and logon.

Enjoy!

You may also like the post below:

Today’s Lesson: How To Install MySQL Server on Ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.