In this article, we want to teach you How to install MariaDB on Ubuntu 20.04.
Let’s see what MariaDB is first.
What is MariaDB?
MariaDB Server is one of the most popular open-source relational databases. It’s made by the original developers of MySQL and guaranteed to stay open source. It is part of most cloud offerings and the default in most Linux distributions.
How to install MariaDB on Ubuntu 20.04
Requirements for installing MariaDB on Ubuntu
Install MariaDB on Ubuntu 20.04
For installing MariaDB, first, you should update the index packages with the following command:
sudo apt update
Then install the MariaDB package with the following command:
sudo apt install mariadb-server
Now MariaDB on Ubuntu 20.04 is installed but it will not ask you to set passwords or any other changes.
How to Configure MariaDB on Ubuntu 20.04
In this step you need to run security scrips for the new MariaDB installation with the following command:
This will ask you to make some changes like the database root password. Because you have not set up a password above press Enter for none to continue.
After that, you will ask to set up a root password type N to continue.
Create an administrative user in your MariaDB
In this step, you can create a new account called admin with the same privileges as the root account with password authentication.
Open MariaDB on Ubuntu 20.04with the following command:
Then create a new user with root privileges and password-based access with the following command:
GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Then flush the privileges with the following command:
To exit from the MariaDB shell run the following command:
Now you can test your MariaDB.
Test MariaDB on Ubuntu 20.04
When the installation is finished MariaDB starts running automatically, you can check this with the following command:
sudo systemctl status mariadb
You will see the active running in your output.
Note: if your MariaDB isn’t running you can use the following command to start it.
sudo systemctl start mariadb
You can use the MySQL admin tool that lets you run administrative commands.
sudo mysqladmin version
Or with an administrative user you can run the following command:
mysqladmin -u admin -p version
Hope you enjoy this article about How to install MariaDB on Ubuntu 20.04.