How to install MariaDB + Uninstallation steps

In this MariaDB tutorial, we will learn how to install and uninstall MariaDB on different Operating Systems like Windows, Linus, Ubuntu, etc. Additionally, we will cover the following topics

  • Downloading MariaDB
  • MariaDB Installation and Configuration on Windows
  • MariaDB installation on Linux step by step
  • MariaDB installation in Ubuntu
  • Uninstall MariaDB from Windows
  • Uninstall MariaDB from Linux
  • Uninstall MariaDB from Ubuntu

Downloading MariaDB

To download MariaDB, go to the official page and select the latest version to download: Download MariaDB

MariaDB Installation and Configuration on Windows

Let us see step by step how to install MariaDB in Windows operating system.

To install MariaDB on Windows, you need to follow these steps:

Step 1 – Double-click on the installer to start the installation process.

MariaDB Installation

Step 2 – Accept the End-User Agreement and click the Next button.

Install MariaDB

Step 3 – Select the way you want to install the features and choose the directory that stores the MariaDB files and click on the Next button. The default location on windows is C:\Program Files MariaDB 10.6\

How to install MariaDB
MariaDB Features and Location

Step 4 – Create a password for the Root user account. You will later use this password to access MariaDB Server. The root user is the default user which has all the privileges

If you don’t want the root user to log in from remote machines, uncheck the Enable access from remote machines for 'root' user

The Use UTF8 as default server's character set the option allows us to use the UTF8 character set while creating new databases and tables.

Once you select all the options, click on the Next button to go to the next step.

Install MariaDB in windows
Root Password for MariaDB Server

Step 5 – In this step:

Firstly, install MariaDB as a service by clicking on Install as service and it will allow you to change the name of the service.

Secondly, you need to configure the port for the MariaDB. By default, it uses 3306 but you can change the port if you want.

Thirdly, specify the parameters InnoDB engine including Buffer pool size and Page size. 16KB is suitable for most of the databases.

Finally, click on the Next button to go on to the next step.

How to install MariaDB in windows
Configure MariaDB Server

Step 6 – Click Install to start the installation.

MariaDB installation on windows
Ready to install MariaDB

It may take a few minutes to complete depending upon the system.

Installing MariaDB on windows
Installing MariaDB

Step 7 – Click on the Finish button to complete MariaDB installation.

how to install mariadb on windows
MariaDB installation done

Now, you can find MariaDB tools in the Start menu.

This is how to install MariaDB on windows OS.

Read: MariaDB Grant User Access To Database

MariaDB installation on Linux step by step

Now, let us see how to install MariaDB on Linux.

To install MariaDB on Linux, you need to follow these steps:

Step 1 – Check the Linux version by using the below command before we download MariaDB.

ALTER TABLE gadgets
    ALTER COLUMN location TYPE VARCHAR,
    ALTER COLUMN description TYPE VARCHAR;

Step 2 – Create or edit already existing MariaDB.repo using the below command.

# vi /etc/yum.repos.d/MariaDB.repo

After running this command, we will see whether there is any content inside that repo if there is no content in it. Then, you need to copy the below commands in that file.

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Save the file with:wq!

Step 3 – Now, install the MariaDB Server and MariaDB Client using this command.

# sudo yum install MariaDB-server MariaDB-client

This may take time depending upon the machine.

After the completion of the installation, if you want to check whether the service has started or not. To check this you need to use #cd/var and #cd/lib commands. If mysql is present then the installation went right.

Step 4 – To start the MariaDB service, use the below command.

# sudo systemctl start mysql

Now you can use the below command to see whether the service has started or not.

# sudo systemctl status mysql

Step 5 – Run the secure installation by using the below command to configure the root password and other features. Then, you can set new root password and other features.

# sudo mysql_secure_installation

Step 6 – Now, login to MariaDB using Root using the below command.

 # mysql -uroot -p

The installation of MariaDB in Linux has been completed.

MariaDB installation in Ubuntu

Let us see, how to install MariaDB in Ubuntu.

There are two ways by which we can install MariaDB in Ubuntu

  • Installing MariaDB using Ubuntu Repository
  • Installing MariaDB using MariaDB Repository

Installing MariaDB using Ubuntu Repository

To install MariaDB in Ubuntu using the Ubuntu repository, follow the steps provided below:

Step 1 – In this, you need to update the package index. For that, you need to run the following command.

sudo apt update

After running this command, your packages will be up-to-date.

Step 2 – Now the package list has been updated, you should now install MariaDB by running the following command.

sudo apt install mariadb-server

You may be prompted to enter the password for sudo user.

Step 3 – The MariaDB service will automatically start. However, to check its status by running the following command.

sudo systemctl status mariadb

It should be active and running.

To know the version of the MariaDB that has been installed, you can run the following command.

mysql -V

The output of the command will be the version of MariaDB installed and it is the confirmation that you have successfully installed MariaDB on your Ubuntu system.

Installing MariaDB using MariaDB Repository

MariaDB repositories normally host the latest version of MariaDB. Before starting the installation, you must visit the official MariaDB repository page and check the latest version of MariaDB.

To install MariaDB in Ubuntu using the MariaDB repository, follow the steps provided below:

Step 1 – In this step, you need to run the below command in order to add the MariaDB GPG key to the system.

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

Step 2 – After the key has been imported, run the following command to add the MariaDB repository.

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirrors.accretive-networks.net/mariadb/repo/10.3/ubuntu bionic main'

In case you encounter an error stating “add-apt-repository command not found”, just install the “software-properties-common” package.

Step 3 – Before installing any package from the MariaDB repositories, you should update all the package list. For this, you need to run the following command

sudo apt update

Step 4 – After the repository has been added, you need to run the following command to install the MariaDB package.

sudo apt install mariadb-server

Step 5 – Although, the service should be started automatically, but to verify its status, run the following command

sudo systemctl status mariadb

It should be running and active.

Step 6 – To check the version of MariaDB installed on your computer, you need to run the following command and it will also ensure that the installation is completed successfully.

mysql -V

Also, check: MariaDB Create User

Uninstall MariaDB from Windows

There are several methods to uninstall MariaDB from Windows. Some of them are mentioned below.

Method 1

When any new piece of program is installed on your computer, that program is added to the list of Programs and Features. You can uninstall the program from that list. To uninstall MariaDB from your computer follow the steps

Step 1 – Press Windows and X keys together to open a menu and click on Apps and Features at the top of the menu.

Uninstallation of MariaDB in Windows
Uninstall MariaDB from Windows

Step 2 – Then, Setting Window will open, and in that window, you need to click on Programs and Features present on the top-right corner.

Uninstalling MariaDB in Windows
How to uninstall MariaDB from Windows

Step 3 – You will see the list of programs installed on your computer. You need to select MariaDB and then click on Uninstall Button.

uninstall MariaDB from Windows
How to uninstall MariaDB from Windows

Method 2

In this method, you only need to go to the installation file of MariaDB and find uninstall.exe or unins000.exe. Then, you need to double-click on it and follow the wizard to uninstall MariaDB.

Method 3

In this method, you need not uninstall MariaDB manually as it does not remove it completely. So, it’s recommended that you uninstall MariaDB with a trusted third-party uninstaller that can identify and remove all files of MariaDB.

Note – If nothing works, then you can uninstall MariaDB via System restore by choosing a Restore point. But, you need to backup your personal data that were created or installed on your computer after the installation of MariaDB.

Read: MariaDB Create Database

Uninstall MariaDB from Linux

Step 1 – To uninstall MariaDB from Linux CentOS, you need to run the following command

sudo yum remove MariaDB-server MariaDB-client

If you don’t have a MariaDB client, then you can simply run the above command without MariaDB-client.

Step 2 – The uninstallation does not remove the data directory /var/lib/mysql. If you need to use it then you can leave it for future use. Otherwise, you can remove it by using the below command.

sudo rm -r /var/lib/mysql

Uninstall MariaDB from Ubuntu

To delete MariaDB completely from your computer, you need to follow these steps.

Step 1 – Before the process of uninstallation, you need to check the status and the version of MariaDB by running the following command.

systemctl status mariadb

Step 2 – In this step, you need to run the purge command to remove the MariaDB package.

apt purge "mariadb*" -y

Step 3 – Now, run the autoremove command to completely delete the configuration files.

apt autoremove -y

Step 4 – To verify that the uninstallation is successfully completed, you need to check the status of MariaDB service.

systemctl status mariadb

The output of this command will ensure you the uninstallation of the MariaDB service.

In this tutorial, we have learned about the installation and uninstallation of MariaDB. Additionally, we have covered the following topics

  • Downloading MariaDB
  • MariaDB Installation and Configuration on Windows
  • MariaDB installation on Linux step by step
  • MariaDB installation in Ubuntu
  • Uninstall MariaDB from Windows
  • Uninstall MariaDB from Linux
  • Uninstall MariaDB from Ubuntu