Step-by-Step Guide- How to Install MariaDB on Ubuntu in No Time
How to Install MariaDB on Ubuntu
Installing MariaDB on Ubuntu is a straightforward process that can be completed in a few simple steps. MariaDB is a popular open-source relational database management system that is a fork of MySQL. It offers a wide range of features and is widely used for various applications, from small websites to large enterprise systems. In this article, we will guide you through the process of installing MariaDB on an Ubuntu server or desktop.
Prerequisites
Before you begin the installation, make sure that your Ubuntu system is up to date. You can update your system by running the following commands:
“`bash
sudo apt update
sudo apt upgrade
“`
Step 1: Install MariaDB Repository
To install MariaDB on Ubuntu, you need to add the MariaDB repository to your system. You can do this by downloading the repository file from the official MariaDB website and adding it to your sources list.
1. Open a terminal window.
2. Download the repository file using the following command:
“`bash
wget https://dev.mysql.com/get/mysql-apt-repo_0.8.3-1_all.deb
“`
3. Install the repository file using the following command:
“`bash
sudo dpkg -i mysql-apt-repo_0.8.3-1_all.deb
“`
4. Add the repository to your sources list by running:
“`bash
sudo apt update
“`
Step 2: Install MariaDB Server
Now that the repository is installed, you can proceed to install the MariaDB server. You can do this by running the following command:
“`bash
sudo apt install mariadb-server
“`
The installation process may take a few minutes. Once it’s complete, you can start the MariaDB service using the following command:
“`bash
sudo systemctl start mariadb
“`
Step 3: Secure Your MariaDB Installation
After installing MariaDB, it’s essential to secure your installation by setting a root password and removing the anonymous user. You can do this by running the following command:
“`bash
sudo mysql_secure_installation
“`
This script will guide you through the following steps:
1. Set a root password.
2. Remove anonymous users.
3. Disallow remote root login.
4. Remove the test database.
5. Reload privilege tables to apply changes.
Step 4: Verify the Installation
To verify that MariaDB is installed and running correctly, you can run the following command:
“`bash
mysql -u root -p
“`
Enter the root password you set in the previous step. Once logged in, you can run a simple query to check the version of MariaDB:
“`sql
SELECT VERSION();
“`
This will display the version of MariaDB installed on your system.
Conclusion
Congratulations! You have successfully installed MariaDB on your Ubuntu system. Now you can start using this powerful database management system for your applications. Remember to regularly update your system and MariaDB to ensure you have the latest security patches and features.