MySQL is currently not available for Debian 11 Bullseye, so MariaDB is a perfect choice. This article is focusing on how to install MariaDB, an alternative to MySQL on Debian 11.

Install MariaDB on Debian 11

The MariaDB packages are available under the official repositories. You can directly install it without adding an extra repo to your system. For this tutorial, we will install MariaDB on Debian 11 system via default repositories. Firstly, update the packages list using: Now, to install MariaDB, execute the below-mentioned command:

Configure MariaDB on Debian

To configure MariaDB properly we need to run a security script using the below-mentioned command: After running the above command, you will be prompted with various options:

The options are self-explanatory, for the first two options choose “n” and for the next sequence of options press “y” for yes.

Create Privileges User with Authentication

For security purposes, MariaDB uses a unix_socket plugin to authenticate the root user. This may cause complications therefore, it is recommended to set a new user with password-based access. And to create a new user login to MariaDB using: Now create a new user with a password in the MariaDB server. Make sure to change admin with your username and pas$$w0rd with a new secure password. Next, grant permissions on all databases to a newly created account. Here the GRANT OPTION allow a user to create other users and assign them permissions. Apply the new changes, execute: And to quit typing “exit”. The SQL statements are case insensitive, So you can write them in any case.

Connect MariaDB Server

One can manage MariaDB service using the Systemd. To test the status of MariaDB use the following command: If for some reasons MariaDB is not running then use the below-mentioned command to start it: For one more check you can try to connect to the database using: Next, connect to the MySQL shell by using the credentials created in the above step. The output of the above command asks for the password; use the password you set in the above steps. On successful authentication, you will get the MariaDB shell as below:

Conclusion

MariaDB is an open-source alternative to MySQL in the latest version of Debian. This write-up is a guide to install MariaDB on Debian 11 Bullseye. We learned how to install and configure MariaDB on Debian 11. We also created a separate user to manage the database with password access. Finally, we also discussed utilities to test the MariaDB status.

How To Install MariaDB on Debian 11   TecAdmin - 10How To Install MariaDB on Debian 11   TecAdmin - 60