How to Install MariaDB on Ubuntu: A Step-by-Step Guide

Title: How to Install MariaDB on Ubuntu: A Comprehensive Guide for Professionals

Introduction: This comprehensive guide provides step-by-step instructions on installing MariaDB on a Vultr Ubuntu cloud server. Suitable for professionals, this guide is applicable to Ubuntu 16.04 through Ubuntu 20.10 LTS versions. MariaDB, a robust and feature-rich relational database management system, serves as a drop-in replacement for MySQL.

  1. Deploying Ubuntu Server Before proceeding with the installation, deploy a new instance of the Ubuntu Vultr cloud server. Follow the best practices guides listed below to ensure a secure and optimized setup:
  • Create a sudo user
  • Update the Ubuntu server
  • Switch to the sudo user for the remaining steps
  1. Installing MariaDB To install MariaDB and set it up as a replacement for MySQL, execute the following commands in the terminal:
$ sudo apt install mariadb-server mariadb-client -y

Enable MariaDB to start automatically during system boot with the following command:

$ sudo systemctl enable mariadb.service

To secure the MariaDB installation, run the MySQL Secure Installation script:

$ sudo mysql_secure_installation

During the script execution, respond to the security questions as follows:

  • For the initial root password, press ENTER as there is no password set.
  • When prompted, set a new password for the root account and confirm it.
  • Press ENTER to remove the anonymous user.
  • Disallow remote root logins by pressing ENTER.
  • Press ENTER to remove the test database.
  • Reload the privilege tables by pressing ENTER.
  1. Testing the Installation Ensure the installation was successful by connecting to the MariaDB server as the root user:
$ mysql -u root -p -h localhost

Within the MariaDB client, create a test user and a test database:

> CREATE USER 'test_user'@'localhost' IDENTIFIED BY 'test_pass';
> CREATE DATABASE test_database;

Grant the test user all privileges on the test database:

> GRANT ALL PRIVILEGES ON test_database.* TO 'test_user'@'localhost';

Exit the MariaDB client:

> quit

Conclusion: Congratulations! You have successfully installed MariaDB on a Vultr Ubuntu cloud server. For further information and advanced usage, refer to the official MariaDB documentation.

For more details, visit: Link to official MariaDB documentation

How to Install MariaDB on Ubuntu?

Follow up above steps.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply