- Installing MariaDB using APT
- Import the GnuPG signing key
- New key
- Add MariaDB to your sources.list
- Installing MariaDB with apt-get
- Installing MariaDB Galera Cluster with apt-get
- Installation Issues
- Upgrading mariadb-server and mariadb-client packages
- Version Mismatch Between MariaDB and Ubuntu/Debian Repositories
- Installing the .deb Files Manually
- .deb files distributed as part of MariaDB
- See also
Installing MariaDB using APT
For Debian and Ubuntu, it is highly recommended to install from the
synaptic or another package
The easiest way to get things set up is to use our online repository configuration tool and follow the instructions it generates.
Import the GnuPG signing key
First import the GPG key we use to sign the repositories. This step only needs to be performed once on a given server. The key enables
apt to verify the integrity of the packages it downloads.
The id of our signing key is
0xcbcb082a1bb943db and the full key fingerprint is:
1993 69E5 404B D5FC 7D2F E43B CBCB 082A 1BB9 43DB
apt-key application is an easy way to import this key into apt:
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
While importing the signing key, either on an Ubuntu or Debian system. The import command remains same.
Example: localhost:~# apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.ASyOPV87XC --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db gpg: requesting key 1BB943DB from hkp server keyserver.ubuntu.com gpg: key 1BB943DB: "MariaDB Package Signing Key <firstname.lastname@example.org>" imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1
Once the key is added you are ready to add the appropriate repository.
As of Ubuntu 16.04 "Xenial" and Debian Sid, our signing key has changed. The id of the new signing key is
0xF1656F24C74CD1D8 and the full key fingerprint is:
177F 4010 FE56 CA33 3630 0305 F165 6F24 C74C D1D8
This new key can be imported using
apt-key like so:
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
The old key is still used for previous versions of Ubuntu and Debian. If in doubt over which key you need it is perfectly safe to import both keys.
Add MariaDB to your sources.list
To easily generate the appropriate sources.list entries (also known as APT lines), use our online repository configuration tool.
In the tool, choose "debian" or "ubuntu", depending on which distribution you are using, and then choose the specific release, and then the version of MariaDB you want to install. For example, here are instructions for adding the MariaDB 10.0 repository using the primary MariaDB mirror and Ubuntu 14.04 "trusty":
sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main'
You can find out which release you are using with:
Once you have your sources.list entries, add them to your local
(e.g. with "
sudo gedit /etc/apt/sources.list
or to a separate file under
(e.g. with "
sudo gedit /etc/apt/sources.list.d/mariadb.list
You can also use the "Software Sources" tool to add the APT lines. This tool is found under the "Edit" menu in the "Ubuntu Software Center". In the "Synaptic" package manager this tool is called "Repositories" and it is located under the "Settings" menu. After launching the tool choose the "Other Software" tab, click on the "Add..." button and paste in the APT line (once for each of the two lines).
Like adding the GPG key, this step only needs to be done once on a given server.
Installing MariaDB with apt-get
With the key and the APT lines in place you can now run:
sudo apt-get update
...to download the information apt needs to know to install MariaDB.
MariaDB can then be installed with your favorite package manager, for example:
sudo apt-get install mariadb-server
Installing TokuDB with apt-get
Instructions for installing TokuDB are on the How to Enable TokuDB in MariaDB page.
Installing MariaDB Galera Cluster with apt-get
MariaDB until 10.0
The instructions for installing MariaDB Galera Cluster are virtually the same
as for installing MariaDB. The importing of the signing key and creating
the sources.list entry are both the same. The only difference is in the install
step. Instead of installing the
mariadb-server package, you install the
mariadb-galera-server package, like so:
sudo apt-get install mariadb-galera-server
If the server already has the
mariadb-server package installed, it will be
automatically removed prior to installing
MariaDB Galera Cluster also has a
galera-arbitrator-3 package. This package
should be installed on whatever node you want to serve as the arbitrator. It
can either be a separate node that does not have
installed on it (recommended), or an existing node that is also running MariaDB
Galera Server. It is installed like so:
sudo apt-get install galera-arbitrator-3
See the Galera section of the Knowledgebase for more information on MariaDB Galera Cluster.
MariaDB starting with 5.5
As noted in MDEV-4266, the
have a minor upgrade issue if you use '
apt-get install mariadb-server' or
apt-get install mariadb-client' to upgrade them instead of the more common
apt-get upgrade'. This is because those two packages depend on
mariadb-client-5.5 with no specific version of
those packages. For example, if you have the
installed, version 5.5.29 and you install version 5.5.30 of that package it
will not automatically upgrade the
mariadb-server-5.5 package to version
5.5.30 like you would expect because the 5.5.29 version of that package
satisfies the dependency.
mariadb-client packages are virtual packages,
they only exist to require the installation of the
mariadb-client-5.5 packages, respectively. MariaDB will function normally
with a, for example, version 5.5.30 version of the
and a version 5.5.29 version of the
mariadb-server-5.5 package. No data is
at risk. However, expected behavior is for '
apt-get install mariadb-server'
to upgrade everything to the latest version (if a new version is available), so
this is definitely a bug.
A fix is planned for this bug in a future version of MariaDB. In the mean time,
when upgrading MariaDB, use '
apt-get upgrade' or
apt-get install mariadb-server-5.5'.
MariaDB 5.1 - 5.5
Version Mismatch Between MariaDB and Ubuntu/Debian Repositories
As mentioned here (and in MDEV-4080 and MDEV-3882)
sometimes APT will refuse to install MariaDB. Or, if MariaDB is already installed, suggest the removal of MariaDB to apply an upgrade to the
libmysqlclient packages. This happens whenever the version
number of those two packages is higher in the distribution repositories than
the versions in the MariaDB
repositories. Most MariaDB packages have different names than their MySQL
counterparts, but in order for upgrades from MySQL to MariaDB to be successful
in APT, those two packages must be named the same. Because they have the same
names, APT just checks the version numbers and tries to install what it
considers to be the most recent.
It is rare for the version numbers of
libmysqlclient to be
higher in the official Ubuntu or Debian repositories than they are in the
MariaDB repositories, but it has happened. Whenever it has it has been because of
critical bug fix releases for bugs that existed in the
version of MySQL in the distribution repositories but which had already been
fixed in the version of MariaDB in the MariaDB repositories.
If a situation as described above exists when you try to install MariaDB you will get an error like this:
The following packages have unmet dependencies: mariadb-server : Depends: mariadb-server-5.5 but it is not going to be installed E: Unable to correct problems, you have held broken packages.
There are three primary ways of fixing this issue:
Click on the links above to jump to directions for each (or simply scroll down).
Pinning the MariaDB Repository
It is possible to pin the MariaDB repository used so the packages it provides will always have an higher priority over the ones from the system repositories.
This is done by creating a file with the '
.pref' extension under '
/etc/apt/preferences.d/' with the
Package: * Pin: origin <mirror-domain> Pin-Priority: 1000
<mirror-domain>' with the domain name of the MariaDB mirror you
use. For example '
Specifying Specific Versions to Install
A way to fix this is to specify the exact version of the two packages that you
want to install. To do this, first determine the full version numbers of the
affected packages. An easy way to do so is with
apt-cache show mysql-common | grep Version apt-cache show libmysqlclient18 | grep Version
For each of the above you will be given a list of versions. The ones in the MariaDB repositories will have "mariadb" in the version strings and are the ones you want. With the version numbers in hand you will be able to install MariaDB by explicitly specifying the version numbers like so:
apt-get install mariadb-server-5.5 mariadb-client-5.5 \ libmysqlclient18=<version-number> \ mysql-common=<version-number>
Replace the two instances of
<version-number> in the example above with the
actual version number of MariaDB that you want to install.
Even after having installed these specific packages versions, running '
apt-get dist-upgrade' will still try to upgrade the packages to the highest version available.
After MariaDB is installed, and as long as the version number issue exists, an
apt-get dist-upgrade' will try to remove MariaDB in order to install the
mysql-common packages. To prevent this from
happening you can hold them so that apt doesn't try to upgrade them. To do
so, open a terminal, become root with '
sudo -s', and then enter the
echo libmysqlclient18 hold | dpkg --set-selections echo mysql-common hold | dpkg --set-selections
The holds will prevent you from upgrading MariaDB, so when you want to remove
the holds, open a terminal, become root with '
sudo -s', and then enter the
echo libmysqlclient18 install | dpkg --set-selections echo mysql-common install | dpkg --set-selections
You will then be able to upgrade MariaDB as normal
(e.g. with '
sudo apt-get update; sudo apt-get upgrade').
Installing the .deb Files Manually
While it is not recommended, it is possible to download and install the
packages manually (i.e. without a package manager like apt-get). Browse the
directories below the "repo/" directory on your closest mirror. The .deb files
Here are the commands we used on a Debian 5 amd64 box to install MariaDB 5.1.42 (other Debian-based distributions should be similar):
sudo apt-get update sudo apt-get install libdbi-perl libdbd-mysql-perl psmisc sudo dpkg --install mysql-common_5.1.42-mariadb73_all.deb sudo dpkg --install libmariadbclient16_5.1.42-mariadb73_amd64.deb libmysqlclient16_5.1.42-mariadb73_amd64.deb \ mariadb-client_5.1.42-mariadb73_all.deb mariadb-client-5.1_5.1.42-mariadb73_amd64.deb mariadb-server_5.1.42-mariadb73_all.deb \ mariadb-server-5.1_5.1.42-mariadb73_amd64.deb
.deb files distributed as part of MariaDB
Each version of MariaDB includes different files, as new features are added (or removed), package names are updated to match the version number the product, and different platforms allow for particular components to be built that cannot be built on other platforms.
Here's an example list of all the .deb files distributed for MariaDB 10.1.17 on Ubuntu Xenial (16.04 LTS):