MariaDB is an open-source relational database management system (RDBMS) that is a fork of MySQL.MariaDB is used as the database backend for many web applications, content management systems (CMS), and other data-driven software. It provides a reliable and efficient database solution for developers and system administrators.
To install MySQL on a Debian-based system, follow these steps:
Step 1:Update Your Package List
First, update the system package list to make sure your package index is up to date.
# sudo apt update
Step 2: Install MariaDB Server
To install MariaDB, run the following command:
# sudo apt install mariadb-server
This will install the MariaDB server package and the necessary dependencies.
Step 3: Start and Enable MariaDB Service
MariaDB should start automatically after installation, but you can check the service status and ensure it is running:
To check the status of the MariaDB service:
# sudo systemctl status mariadb
Step 4: Run the MariaDB Secure Installation Script
After installing MariaDB, it’s important to run the mysql_secure_installation script to configure the database securely. This will allow you to set a root password, remove insecure default settings, and configure other security features.
Run the following command:
# sudo mysql_secure_installation
You will be prompted with a series of questions:
Set a root password if you haven’t done so already.
Remove the test database (recommended).
Disallow remote root login (recommended).
Reload privilege tables to apply the changes
Step 5: Verify MariaDB Installation
To verify that MariaDB is working correctly, log in to the MariaDB shell as the root user:
# sudo mysql -u root -p
Enter the root password when prompted.
You should see the MariaDB prompt:
$ MariaDB [(none)]>
You can exit the MariaDB shell by typing:
# exit
Conclusion:
By following the installation steps, including securing the database and configuring essential settings, you can ensure that MariaDB is ready for use in production environments.