MariaDB is a popular management system relational database (RDBMS) open source created by the developers of MySQL. It is fast, scalable and reliable database system with a rich ecosystem of storage engines, plugins and many other tools that provide a SQL interface for data access.
MariaDB is an enhanced replacement for MySQL, used by such organizations and companies as Wikipedia, WordPress, Google and many others. In this short article we will show you how to install MariaDB in Debian 10.
Note: if you are working with the system as a user without administrator rights, use the sudo command to obtain root privileges, and if you have MySQL installed and running, stop and disable that before you start.
Installing MariaDB on Debian 10
You can install MariaDB server package from the official Debian repositories by running the following command, which will install the MariaDB server, client and all its dependencies.
apt install mariadb-server
In Debian and its derivatives such as Ubuntu, the common practice of auto-start and enable daemons via systemd immediately after their installation. The same applies to the service MariaDB. You can test the MariaDB service using following command.
systemctl status mariadb
In addition, you also need to know other General commands to control the service in systemd MariaDB, which include commands to start, restart, stop and restart the MariaDB service as shown.
systemctl start mariadb
systemctl restart mariadb
systemctl stop mariadb
systemctl reload mariadb
Configure MariaDB in Debian 10
The process of installation of MariaDB includes protection of the installation by default, and this can be done by running the shell script mysql_secure_installation which will allow you to add a little extra security to your MariaDB instance with:
- Set the password for the account root.
- Disable remote login as root.
- Delete user accounts the anonymous user.
- Remove the test database, which by default can handle anonymous users.
To trigger the security script, run the following command and answer the questions as shown in the following screenshot.
After you protected setup MariaDB, you can connect to the mysql shell using the root password.
To create a database with the name my_test_db and a user named test_user with full privileges to manage the database, run the following SQL command.
MariaDB [(none)]> CREATE DATABASE my_test_db;
MariaDB [(none)]> GRANT ALL ON my_test_db.* TO 'test_user'@'localhost' IDENTIFIED BY 'test_user_pass_here' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;
Setup Debian MariaDB 10 is completed. After creating a new database and database user, try to get shell access MariaDB using the new user account, and print all of the database assigned to the user in the following way.
mysql-u test_user -p
MariaDB [(none)]> SHOW DATABASES;
That’s all! In this article, we showed how to install MariaDB Debian 10. Use the comment form below to contact us for any questions or information you would like to share with us.