How to Install MariaDB on Kali Linux 1

How to Install MariaDB 10.7 on Kali Linux

MariaDB is an enterprise-level relational database management system. It is an open-source database similar to MySQL—a project by Oracle. MariaDB is not only robust but also highly compatible. It is essential to learn how to install MariaDB 10.7 on Kali Linux.

With its wide community, MariaDB is stable and maintains high compatibility with Oracle’s MySQL. In this article, we will cover how to install MariaDB on Kali Linux. Before we start with the installation, let’s look at some of the new improvements in MariaDB:

  • New Universally Unique Identifiers (UUID) Data Types.
  • Natural sort for string sorting in alphabetical order.
  • Python-like format functions.
  • InnoDB Bulk insert for bulk insert and building indexes.
  • New password validation plugin called Password Reuse.
  • Affected row identification using Diagnostics Property. 

These are some of the prominent properties in the new MariaDB update. Let’s start with the setup of MariaDB on Kali Linux machines. 

1. Update Kali Linux

First, update your Kali Linux system before starting with the installation of MariaDB. You can update the packages by using the apt update command as shown below:

sudo apt update

If updates are available, then perform the upgrade. For example:

sudo apt upgrade

You should get a similar output:

Update Kali Linux

Alternatively, you can also use this command:

sudo apt dist-upgrade -y

After that, reboot your system using the reboot command if required. To check if a reboot is required after the upgrade, execute the following command:

[ -f /var/run/reboot-required ] && sudo reboot -f

Or you can simply use the reboot command:

sudo reboot

2. Add MariaDB Repository

Secondly, we will add MariaDB Repository in the Kali package manager. Execute the commands given below to add the MariaDB package:

sudo apt-key adv --recv-keys --keyserver 0xF1656F24C74CD1D8
echo "deb [arch=amd64] bullseye main" | sudo tee /etc/apt/sources.list.d/mariadb.list

You should get a similar output seen below:

Add MariaDB Repository

3. Download MariaDB 10.7 

After that, we will add the dependency packages to our repository like any other Debian system. To install dependency packages, execute the following command: 

sudo apt install wget curl gpg gnupg2 software-properties-common apt-transport-https lsb-release ca-certificates dirmngr

Press “Y” to continue with the installation. 

Next, download the MariaDB script for Linux OS machines from its website. Alternatively, you can also use the wget command to download the MariaDB setup. For example:


This is what the installation would look like in your screen:

Download MariaDB 10.7 on Kali Linux

To access the help page of this script, run it with the bash command followed by the --help flag. For instance:

sudo bash mariadb_repo_setup --help

You should then get a similar output as this one:

Download MariaDB 10.7 on Kali Linux

Next, we will set the OS type and command options as Kali Linux. We are doing this because Kali Linux is not on the list of distributions supported by MariaDB. For this step, we will edit the MariaDB bash script using the bash command. 

sudo bash mariadb_repo_setup --os-type=debian --os-version=bullseye 

You will get a similar output:

Download MariaDB 10.7 on Kali Linux

Notice here that this file consists of the required MariaDB configurations for any operating system. We will modify it for Debian distribution and its bullseye version. After that, add the MariaDB Server version using the same sudo bash command. Use the following command specifically:

sudo bash mariadb_repo_setup --mariadb-server-version=10.7

Hence, the new configured MariaDB script for Kali Linux has been created. 

Next, we will confirm that this script is functional by using the cat command. For example:

cat /etc/apt/sources.list.d/mariadb.list

Here is what it should look like:

Download MariaDB 10.7 on Kali Linux

After that, update your system to ensure the changes. 

sudo apt update

4. Install MariaDB 10.7 on Kali Linux

Finally, we are ready to install MariaDB on Kali Linux. For this step, use the apt-cache command. For example:

sudo apt-cache policy mariadb-server

You should then get a similar output as this: 

Install MariaDB 10.7 on Kali Linux

Now, install MariaDB server and client packages together on Kali Linux. For this step, use the apt install command. Which is:

sudo apt install mariadb-server mariadb-client

You will get a similar output:

MariaDB Server and Client

To confirm the installation of MariaDB, use the –version flag with mariadb. For instance:

mariadb –version

This is the output you should get:

MariaDB Version

5. Fixing Error in MariaDB 10.7

Type in these commands, In case you encounter errors similar to the ones given below:

mariadb-server-core-10.7 : Depends: liburing1 (>= 0.7)” or “The following packages have unmet dependencies:”, you will have to install the package manually. For this step, use the wget command to get the required dependencies.


After that, install the downloaded package. For example: 

sudo dpkg -i liburing1_0.7-3~bpo10+1_amd64.deb

Next, install MariaDB again using the apt install command as follows: 

sudo apt install mariadb-server mariadb-client

You should be getting a similar output as this:

Fixing Error in MariaDB 10.7

If there are unrequired packages, then remove them using the apt autoremove command. Specifically:

sudo apt autoremove

6. Start MariaDB on Kali Linux

Now, we will enable the MariaDB service and start it. For both the actions, we will use the systemctl command. For example: 

sudo systemctl enable mariadb
sudo systemctl start mariadb

You should be getting a similar output as this:

Start MariaDB Service

Next, check the status of the service running. To do this, input the command: 

systemctl status mariadb

You should be getting a similar output as this:

Check MariaDB Service Status

7. Secure MariaDB Installation on Kali Linux

Lastly, we will secure MariaDB installation by using the mariadb-secure-installation as shown below:

sudo mariadb-secure-installation

You should get similar results as this:

Use MariaDB on Kali Linux

Type “Y” in the authentication section. Next, it will ask you to change the root password. Type “Y” and enter the new password. Hit “Y” in the rest of the options. After that, check the new authentication. You will get an access denied message. 

To fix this, type the following command: 

mysql -u root -p

The -p flag will provide the password option. Here, we can add the password that we have just set. 

Now, your output would look like this:

Use MariaDB on Kali Linux

To exit from MariaDB, type exit and hit “Enter key”.

Finally, you have installed and used MariaDB on Kali Linux successfully.

8. Uninstall MariaDB from Kali Linux

To uninstall MariaDB from Kali Linux, we will first remove its server and clean all the packages. For this step, execute the purge command as seen below:

sudo apt purge mariadb-server

Secondly, we will remove all the data related to the database. This is stored in /var/lib/mysql/ directory. So we will delete that using the rm command, which should look like this: 

sudo rm -rf /var/lib/mysql/

Next, we will remove the client package and dependencies related to this package. Use the apt autoremove command. For example:

sudo apt autoremove mariadb-server mariadb-client

And finally, you have uninstalled MariaDB from Kali Linux. 

And that marks the end of this guide. Now you have learned how easy it is to install and use MariaDB on Kali Linux, and you also found out how to secure your MariaDB installation using a password. We hope this article was helpful to you. For more information on MariaDB, check out its official documentation.

If this guide helped you, please share it.

Leave a Reply
Related Posts