Building a LEMP stack for WordPress on Ubuntu 22.04 LTS

Part 4 M: Installing and configuring MariaDB

DigitalOcean tutorial

Here I’m following DigitalOcean’s guide How To Install MariaDB on Ubuntu 22.04.[1]

Install MariaDB by updating the available package list and entering its installation command as follows:

sudo apt-get update
sudo apt install -y mariadb-server

We now need to secure the MySQL installation by running:

sudo mysql_secure_installation

The process of securing MariaDB starts with the following message:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):

As this is a clean installation, we can press enter as instructed. The next message is:

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n]

We protected the root account when setting up the server and can answer ‘n’ as suggested and hit enter.

Next, you’ll be asked if you want to remove anonymous users, disable remote root login, remove the test database, and reload the privilege tables — press enter to select Y for all of these. This concludes securing the database and the MariaDB installation process.

Notes and references[+]

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.