أخر الاخبار

How to Install MariaDB on Debian 10

 

How to Install MariaDB on Debian 10

MariaDB is an open-source, multi-threaded relational database management system, which replaces backward-compatible MySQL. MariaDB is the default implementation of MySQL in Debian. This tutorial explains how to install MariaDB on Debian 10.


Install MariaDB on Debian 10

At the time of writing this article, the latest version of MariaDB available in the Debian repositories is version 10.3.


Perform the following steps as root or user with sudo privileges to install MariaDB on Debian 10:


1. Start by updating the package index:

sudo apt update

2. Install the MariaDB server and client packages by running the following command:


sudo apt install mariadb-server


3. The MariaDB service will start automatically. To verify this, check the service status:


sudo systemctl status mariadb


The output should look like this:





Securing MariaDB

MariaDB comes with a script that can help you improve installation security. To run the script type mysql_secure_installation in your terminal:

sudo mysql_secure_installation


You will be prompted to set a password for the root account, remove the anonymous user, restrict root user access to the local machine, and remove the test database.





If this option is selected, the script will reload the privilege tables ensuring that the changes take effect immediately.


All steps are explained in detail and it is recommended to answer “Y” (yes) to all questions.


Authentication methods

By default, the MariaDB root user uses the  unix_socket authentication plugin which verifies the effective user ID when calling the mysql client tool.


This means that you can connect to the MariaDB server as root only if you invoke the  mysql command as system root or by adding sudo to the command.


For added security, it is recommended to keep the default authentication plugin and allow the root user to authenticate only through Unix sockets.


If you want to change root authentication to classic, connect to the MariaDB server:


sudomysql


Execute the following instructions to modify the authentication plugin:


ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'your_root_passwd';


You can now connect to the MariaDB server using the new password:


mysql -u root -p


Changing the authentication plugin will also allow you to log in as root from an external program such as phpMyAdmin.


Conclusion

In this tutorial, we showed you how to install and secure MariaDB on a Debian 10 server. If you have any questions or suggestions, let us know in the comments. Also check out this guide if you want to learn How to Install PHP 8 on Debian 10 .


NT
بواسطة : NT
Information aims to help you progress in improving your site. Commitment to provide maximum value to you through your written content.
Comments



Font Size
+
16
-
lines height
+
2
-