Check this Out!Visit our social network pages for recent updates!

Lesson 1: How to Install MariaDB on Ubuntu

Student lesson 1: This brief tutorial shows students how to install MariaDB database server on Ubuntu systems.

Students from everywhere enjoy our tutorials. We write our guides so simple to read and understand that users from different corners send us emails thanking us for these wonderful tutorials.

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

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

 

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.

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 mysql
sudo systemctl start mysql
sudo systemctl enable mysql

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!

Leave a Reply