Save 50% for your first year of web hosting!

How To Install MariaDB on Debian 10

MariaDB is an open-source database management tool and is often installed as an alternative to MySQL since it has significant performance differences.

Step 1: Install MariaDB

To install the server:

sudo apt-get install mariadb-server

Enable it on restart:

sudo systemctl enable mysql.service

Start MariaDB:

sudo systemctl start mysql.service

Step 2: Configure MariaDB

To configure MariaDB:

sudo mysql_secure_installation

You will now be prompted with a configuration setup file. Please read through it and configure it to your liking. It is recommended to disable logins that are not from localhost.

  • Enter current password for root (enter for none): press Enter
  • Set root password? [Y/n]: Y
  • New password: Enter password
  • Re-enter new password: Repeat password
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]:  Y
  • Reload privilege tables now? [Y/n]:  Y

Step 3: Create your Database

After this you may create your database, but first we need to login into MySQL:

sudo mysql -u root -p

You can create your database by running the following commands. We will call it database1 although you are free to call it whatever you want.

CREATE DATABASE database1;

To create a new user:

CREATE USER 'database1'@'localhost' IDENTIFIED BY 'password_here';

To assign the user to the joomla database and give it all permisions:

GRANT ALL ON database1.* TO 'database1'@'localhost' IDENTIFIED BY 'password_here' WITH GRANT OPTION;

Remember to change password_here with your actual password.

Exit and flush for the changes to take affect:

FLUSH PRIVILEGES;
EXIT;