In this MariaDB tutorial, we will learn how to install MariaDB on Linux, Windows, and Ubuntu. Windows, Linux, and Ubuntu.
How to install MariaDB
Before the installation process, let us first download MariaDB.
Downloading MariaDB
To download MariaDB, go to the official page and select the latest version to download: Download MariaDB. The MariaDB software is managed by the MariaDB Foundation whose headquarters is in Finland and the United States of America.
Case-1 On Windows
To install MariaDB on Windows, follow the below steps.
1. Double-click on the installer to start the installation process.

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

3. Select the way we want to start the installation of 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\

4. Create a password for the Root user account. You will later use this password to access the 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.

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.
Thirdly, specify the parameters of the InnoDB engine, including Buffer pool size and Page size. 16KB is suitable for most databases.
Finally, click on the Next button to go on to the next step.

6. Click Install to start the installation.

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

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

Now, you can find MariaDB tools in the Start menu.
Fix the Setup Wizard Ended Prematurely error, in case you are getting it during the installation process.
Read How to Create Table in MariaDB
Case-2 On Linux
To install mariadb on linux, follow the below steps.
1. Check the Linux version using the below command before downloading MariaDB.
ALTER TABLE gadgets
ALTER COLUMN location TYPE VARCHAR,
ALTER COLUMN description TYPE VARCHAR;
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, you need to copy the commands below into 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!
3. 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 installation is completed, 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.
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
5. Run the secure installation by using the below command to configure the root password and other features. Then, you can set a new root password and other features.
# sudo mysql_secure_installation
6. Now, login to MariaDB using Root using the below command.
# mysql -uroot -p
The installation of MariaDB in Linux has been completed.
Case-3 On Ubuntu
Let us see how to start the installation of MariaDB in Ubuntu.
There are two ways in Ubuntu by which we can install MariaDB
- Install MariaDB using Ubuntu Repository
- Install MariaDB using MariaDB Repository
Installing MariaDB using Ubuntu Repository
To install MariaDB on Ubuntu, follow the below steps.
1. In this, we need to update the package index. To do that, you need to run the statement.
sudo apt update
Your packages are updated after executing this command.
2. After updating the list of packages, you should start installing MariaDB by running the statement.
sudo apt install mariadb-server
We may be asked to enter the user’s credentials.
3. The MariaDB service will automatically start. However, we can check its status after executing the query below.
sudo systemctl status mariadb
The status will be running and active.
To check the installed MariaDB version, you can execute the statement below.
mysql -V
The output of the statement will be the MariaDB version installed, which confirms that we have installed MariaDB successfully on Ubuntu.
Install MariaDB using MariaDB Repository
MariaDB repositories have the latest version. Before initiating the installation process, we must check the MariaDB official website and verify the latest version.
To start the installation of MariaDB in Ubuntu using the MariaDB repository, follow the steps provided below:
1. In this step, you need to run the below command to add the GPG key of MariaDB with Ubuntu.
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
2. After the key is imported, execute the statement for adding the repository of MariaDB.
sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://mirrors.accretive-networks.net/mariadb/repo/10.3/ubuntu bionic main'
If we encounter an error stating “add-apt-repository command not found”, we need to start the installation of the “software-properties-common” packages.
3. We should keep the package lists updated before installing any other packages present in MariaDB’s repositories. To do this, you need to execute the statement below.
sudo apt update
4. After adding the repository, we need to execute the below command to start the installation of the MariaDB package.
sudo apt install mariadb-server
5. Although the service automatically starts, to check the status, execute the below statement.
sudo systemctl status mariadb
The status will be running and active.
6. To verify the MariaDB version installed on our PC, we need to run the below command to ensure that the installation is completed successfully.
mysql -V
Read How to Grant User Access to a MariaDB Database
Now, if you don’t want MariaDB on your system anymore you can quickly uninstall MariaDB.
You may like the following MariaDB tutorials:
- How to Start MariaDB in CentOS 7
- How to create a user in MariaDB
- MariaDB DATEDIFF Function
- MariaDB Create Sequence
In this tutorial, we have learned about the installation of MariaDB.
I am Bijay having more than 15 years of experience in the Software Industry. During this time, I have worked on MariaDB and used it in a lot of projects. Most of our readers are from the United States, Canada, United Kingdom, Australia, New Zealand, etc.
Want to learn MariaDB? Check out all the articles and tutorials that I wrote on MariaDB. Also, I am a Microsoft MVP.