How To Secure & Install MariaDB On Ubuntu Desktop 20.04

—START HERE—

Follow this guide to install and start securing MariaDB on Ubuntu desktop 20.04.

  1. Update Ubuntu 20.04 and install MariaDB Server.

sudo apt-get update

sudo apt-get install mariadb-server

  1. Secure the MariaDB installation by running the included security script.

sudo mysql_secure_installation

Press Enter

Sec_mysql_enter

You will be prompted to set a root password. Input Y and input the new password for root and validate it.

Set root password

The Next prompt will ask if you want to remove anonymous users. Input Y

anaon_remove_users

Prompt will request input to disallow remote root login. Input Y

Prompt will request input to remove the test database and access. Input Y

test db remove

Last prompt will request input to reload the privilege tables. Input Y

Last Prompt

Login to the MariaDB server and confirm its running.

sudo mariadb

Enter the password you decided on for root during the first prompt.

Login MariaDB

Create user to access DB other than root.

GRANT ALL PRIVILEGES ON *.* TO ‘sqladmin’@’localhost’ IDENTIFIED BY ‘password_here’;

quit;

quit;

End


You should always harden your servers.

Some useful links:

Secure your MariaDB installation – https://mariadb.com/kb/en/securing-mariadb/

Ubuntu Security and Server hardening – https://ubuntu.com/security