Share your love
Install MariaDB on Ubuntu 20.04
In this article from the Orcacore, we want to teach you How to install MariaDB on Ubuntu 20.04.
Let’s see what MariaDB is in a quick view.
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.
Install MariaDB Server on Ubuntu 20.04 LTS
Requirements for installing MariaDB
For installing MariaDB you need Ubuntu 20.04 server and the server should have a non-root user and a firewall configured with UFW. visit our article about the Initial server setup with Ubuntu 20.04.
Getting started installing 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.
Configuration MariaDB Server on Ubuntu 20.04
In this step you need to run security scrips for the new MariaDB installation with the following command:
sudo mysql_secure_installation
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 be asked 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:
sudo mariadb
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:
FLUSH PRIVILEGES;
To exit from the MariaDB shell run the following command:
exit
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.
For example:
sudo mysqladmin version
Or with an administrative user, you can run the following command:
mysqladmin -u admin -p version
Conclusion
In this article, we try to quick overview of what’s MariaDB Server and how to install it on Ubuntu 20.04.
Hope you enjoy this article about How to install MariaDB on Ubuntu 20.04.
Also, If you need to install MariaDB on other Linux distros, you can follow the below links:
Install and configure MariaDB on Debian 12 Bookworm
Installation MariaDB 10.11 on Rocky Linux 9