Home Database Tips How to Install MariaDB on Windows, Linux, and macOS?

How to Install MariaDB on Windows, Linux, and macOS?

2023-04-04 | Dan Zeng

Table of contents
  • Install MariaDB on Windows
  • Install MariaDB on Linux and Its Distributions
  • Install MariaDB on macOS
  • Conclusion

MariaDB is an open-source relational database management system (RDBMS) that was developed as a fork of the popular MySQL database. It is designed to be a drop-in replacement for MySQL and offers high performance, security features, high availability configurations, scalability options, compatibility with MySQL, and a GPL license. It is available on Windows, Linux distributions, and macOS.

MariaDB_colour_logo.svg.png

Install MariaDB on Windows

1.     Download the latest MariaDB version for Windows.

2.     Click the mariadb-<major>.<minor>.<patch>.msi to start the installer.

3.     Click Next on the welcome page.

4.     Accept the license agreement and click Next.

5.     Choose features to install, specify the directory as default or in another location for the files, and click Next.

6.     If you select the database instance feature, set up the root password and whether to log in as a root user from a remote machine, and choose to use UTF8 as the default character set or not when creating a new database and table. Click Next.

7.     Configure the database. Run the database as a service and define its name under Install as service. Enable TCP/IP and define the port to which MariaDB listens to. Specify the Innodb engine settings like buffer pool size (by default, it’s 12.5% of the RAM and you can add up to 70-80%, but a 32-bit version restricts the maximum as 1 GB) and page size.

8.     Choose to submit the feedback and usage information or not and click Next.

9.     Click Install> Finish.

Install MariaDB on Linux and Its Distributions

On RHEL, CentOS, Fedora, and Other Similar Linux RPM-Based Distributions:

1.     Add the MariaDB yum repository.

Install packages from the MariaDB Package Repository script. 

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

Or install MariaDB with MariaDB Repository Configuration Tool. Then add the generated repository configuration section to /etc/yum.repos.d/MariaDB.repo.

[mariadb]

name = MariaDB

baseurl = https://rpm.mariadb.org/10.6/rhel/$releasever/$basearch

gpgkey= https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

2.     Download the specific release like MariaDB 10.3.34.

[mariadb]

name = MariaDB-10.3.34

baseurl= http://archive.mariadb.org/mariadb10.3.34/yum/centos/$releasever/$basearch

gpgkey= https://archive.mariadb.org/PublicKey

gpgcheck=1

Clean the existing repository configuration if you have any.

sudo yum clean all

3.     Yum will prompt to import the GPG public key to verify the digital signatures of the package for the first time of installation or you can import the key manually.

GPG public id in 2023:

Short: 0xC74CD1D8

Long: 0xF1656F24C74CD1D8

Before 2023:

Short: 0x1BB943DB

Long: 0xcbcb082a1bb943db

sudo rpm --import https://supplychain.mariadb.com/MariaDB-Server-GPG-KEY

4.     Install MariaDB with dnf or yum command.

In MariaDB 10.4 and above:

sudo dnf install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common

In MariaDB until 10.3:

sudo yum install MariaDB-server galera MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common

5.     Install MariaDB Server.

sudo dnf install MariaDB-server

6.     Install MariaDB Clients.

sudo yum install MariaDB-client MariaDB-shared

On SLES, OpenSUSE, and Other Similar Linux Distributions:

1.     Add the MariaDB zypp repository.

Install packages from MariaDB Package Repository script.

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

Or install MariaDB with MariaDB Repository Configuration Tool. Install MariaDB 10.3 on SLES 15 for instance.

sudo zypper addrepo --gpgcheck --refresh https://yum.mariadb.org/10.3/sles/15/x86_64 mariadb

sudo zypper --gpg-auto-import-keys refresh

2.     Pin the repository to a specific release.

sudo zypper removerepo mariadb

sudo zypper addrepo --gpgcheck --refresh https://yum.mariadb.org/10.3.14/sles/15/x86_64 mariadb

3.     Import the GPG pulic key.

sudo rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

4.     Install MariaDB packages with zypp.

In MariaDB 10.4 and later:

sudo zypper install MariaDB-server galera-4 MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common

In MariaDB until 10.3:

sudo zypper install MariaDB-server galera MariaDB-client MariaDB-shared MariaDB-backup MariaDB-common

5.     Install MariaDB Server.

sudo zypper install MariaDB-server

6.     Install MariaDB Clients.

sudo zypper install MariaDB-client MariaDB-shared

On Ubuntu:

1.     Log into Ubuntu 20.04 and update the local repositories.

sudo apt update

2.     Install MariaDB using the PAT package manager.

sudo apt install mariadb-server mariadb-client -y

3.     If you want to install the latest version, follow the steps listed.

a.     Install the prerequisite package.

sudo apt install -y software-properties-common

b.     Import the GPG public key.

sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'

c.     Add the MariaDB APT repository.

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] https://mariadb.mirror.liquidtelecom.com/repo/10.6/ubuntu focal main'

d.     Update the local repositories and install the MariaDB server and client.

sudo apt update && sudo apt install -y mariadb-server mariadb-client

4.     Confirm the version.

mariadb –version

Install MariaDB on macOS

1.     Install Homebrew package manager.

2.     Install MariaDB Server.

brew install mariadb

3.     Start MariaDB Server.

mysql.server start

4.     Log in as user or root.

mysql

sudo mysql -u root

5.     Update brew installation.

brew update

6.     Upgrade the MariaDB Server.

brew upgrade mariadb

7.     Use Homebrew to install a pre-release MariaDB Server. The command builds and installs a development version.

brew install mariadb –devel

Conclusion

This article introduces how to download and install MariaDB on Windows, Linux distributions, and macOS. After the installation and usage, it’s important to backup MariaDB data along the way in case of any data loss incident. Backup and restore 6 databases with MariaDB included in Vinchin Backup & Recovery to secure all databases within 4 steps.

Share on:

Categories: Database Tips