How to Install Latest MariaDB Version on Ubuntu 18.04, Ubuntu 18.10

This tutorial will be showing you how to install the latest version of MariaDB on Ubuntu 18.04 and Ubuntu 18.10 server. MariaDB is a mature, stable, open-source relational database forked from MySQL. Most Linux distributions have replaced MySQL with MariaDB as the default database server. MariaDB powers applications at companies and organizations including Google, Wikipedia, Tencent, Verizon, Deutsche Bank, Huatai Securities and more.

At the time of this writing, the latest stable version is MariaDB 10.3.13, released on February 21, 2019. MariaDB continues adding new features not found anywhere else and also backporting features from MySQL.

Install Latest MariaDB Version on Ubuntu 18.04, 18.10 From Official Repository

The default Ubuntu repository includes MariaDB package, but the version is out of date. Both Ubuntu 18.04 and 18.10 contains only MariaDB 10.1. We can install the latest version from the official MariaDB repository.

Visit and select your Linux distribution, release, version, and the repository mirror that you would like to use. For example, I selected Ubuntu 18.04, MariaDB 10.3 and the Limestone Networks mirror, as shown in the following screenshot.

mariadb ubuntu 18.04 repository

Once all of the choices have been made, customized instructions will appear at the bottom of the page. As an example, I need to run the following commands to add the repository on Ubuntu 18.04.

sudo apt-get install software-properties-common

sudo apt-key adv --recv-keys --keyserver hkp:// 0xF1656F24C74CD1D8

sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] bionic main'

To add the repository on Ubuntu 18.10, simply replace bionic with cosmic in the third command.

Then update package index and install MariaDB server.

sudo apt update

sudo apt install mariadb-server

The galera-3 package will be installed automatically with the MariaDB server. During the installation, you will be asked to create a password for the MariaDB root user.

install mariadb on ubuntu 18.04 bionic

Then confirm your password.

mariadb repository configuration tool

Once the installation finishes, MariaDB server automatically starts. You can check its status with:

systemctl status mysql


systemctl status mariadb

As you can see, it’s active and running.

mariadb status

Hint: Press Q to gain back control of the terminal if the above command doesn’t quit immediately.

If it’s not running, you can manually start it with:

sudo systemctl start mariadb

To enable auto start at boot time, run

sudo systemctl enable mariadb

To log in to MariaDB monitor, run

mysql -u root -p


mariadb -u root -p

Enter the MariaDB root password.

mariadb 10.3

We can see that the server version is 10.3.13, installed from binary distribution. To log out, run



If you previously installed MariaDB from the default Ubuntu repository and now you install the latest MariaDB from, then you will probably encounter the following error when trying to login.

ERROR 1524 (HY000): Plugin 'unix_socket' is not loaded

This is because the binary still uses the mysql_native_password plugin to authenticate user login, whereas the MariaDB binary from Ubuntu repository uses the unix_socket plugin to authenticate user login. The former requires user to enter password, whereas the latter allows user to run the following command to login, without having to provide MariaDB root password.

sudo mysql -u root

Originally MariaDB root user is set to use the unix_socket to login because it’s installed from Ubuntu repository, but now you install a new binary from, which disables the unix_socket plugin, so you will see the above error.

If you would like to continue to use the unix_socket method, then edit the 50-server.cnf file.

sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Add the following line in the [mariadb] unit at the bottom.

plugin_load_add = auth_socket

Save and close the file. Then restart MariaDB server for the change to take effect.

sudo systemctl restart mariadb

If you prefer to use the mysql_native_password method, please see the following article.

There are two other differences worth mentioning.

  1. The MariaDB package from Ubuntu repository uses the /etc/mysql/mariadb.conf.d/50-server.conf file for server configuration, whereas the MariaDB package from repository uses the /etc/mysql/my.cnf file for server configuration on clean install.
  2. The MariaDB package from repository will create a debian-sys-maint user in the database, whereas the MariaDB packages from Ubuntu repository won’t create this user. The password for this user is stored in /etc/mysql/debian.cnf file.

If you see the following error while running the sudo systemctl status mariadb command.

ERROR 1045 (28000): Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)

You may need to reconfigure the mariadb-server-10.3 package with the following command.

sudo dpkg-reconfigure mariadb-server-10.3

When the reconfigure wizard asks you to enter a new root password, you can just press the Tab key and press Enter, so the root password won’t be changed.

Run the Post Installation Script

To secure MariaDB server as much as possible, run the post installation script.

sudo mysql_secure_installation

Enter your MariaDB root password and then answer ‘n’.

mariadb secure installation

Next, you can press Enter to answer all remaining questions, which will remove anonymous user, disable remote root login and remove test database. This step is a basic requirement for MariaDB database security. (Notice that Y is capitalized, which means it is the default answer. )

mariadb ubuntu 18.10

InnoDB vs XtraDB Storage Engine

By default, until MariaDB 10.1, MariaDB uses the XtraDB storage engine, a performance enhanced fork of the InnoDB storage engine from MySQL. However, over time, MySQL has implemented almost all of the improvements. InnoDB has caught up, so from MariaDB 10.2, InnoDB is the default engine.

To check which is the default storage engine, log into MariaDB monitor and run the following command.

show engines;

On MariaDB 10.1, the above command returns the following result, which indicates XtraDB is the default engine.

XtraDB storage engine

On MariaDB 10.2 and 10.3, the above command returns the following result, which indicates InnoDB is the default engine.

InnoDB storage enginesudo dpkg-reconfigure mariadb-server-10.3


That’s it. I hope this article helped you install the latest version of MariaDB on Ubuntu 18.04 and Ubuntu 18.04. As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂

Rate this tutorial
[Total: 5 Average: 5]

3 Responses to “How to Install Latest MariaDB Version on Ubuntu 18.04, Ubuntu 18.10

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community ( for questions unrelated to this article.
  • If my answer helped you, please consider supporting this site. Thanks :)