Home » Operating System » Linux » Installing MariaDB on Ubuntu 18.04 from the MariaDB Repositories


Jl. Meranti Wing 22 Level 4
Kampus IPB Darmaga
Bogor 16680, Jawa Barat, Indonesia
Tlp./Fax +62 (251) 8624535

Monday—Friday: 08:00–16:00

Installing MariaDB on Ubuntu 18.04 from the MariaDB Repositories

At the time of writing this article, the latest version of MariaDB available from the official MariaDB repositories is MariaDB version 10.3. Before continuing with the next step you should visit the MariaDB Repository page and check if there is a new version available.

To install MariaDB 10.3 on your Ubuntu 18.04 server perform the following steps:

  1. First add the MariaDB GPG key to your system using the following command:
    sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8


  2. Once the key is imported, add the MariaDB repository with:
    sudo add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http://ftp.utexas.edu/mariadb/repo/10.3/ubuntu bionic main'


    If you get an error message saying add-apt-repository command not found install the software-properties-common package.

  3. To be able to install packages from the MariaDB repository you’ll need to update the packages list:
    sudo apt update


  4. Now that the repository is added install the MariaDB package with:
    sudo apt install mariadb-server


  5. The MariaDB service will start automatically, to verify it type:
    sudo systemctl status mariadb


    ● mariadb.service - MariaDB 10.3.8 database server
    Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/mariadb.service.d
    Active: active (running) since Sun 2018-07-29 19:36:30 UTC; 56s ago
        Docs: man:mysqld(8)
    Main PID: 16417 (mysqld)
    Status: "Taking your SQL requests now..."
        Tasks: 31 (limit: 507)
    CGroup: /system.slice/mariadb.service
            └─16417 /usr/sbin/mysqld


    And print the MariaDB server version, with:

    mysql -V


    mysql  Ver 15.1 Distrib 10.3.8-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2


Run the mysql_secure_installation command to improve the security of the MariaDB installation:

sudo mysql_secure_installation


The script will prompt you to set up the root user password, remove the anonymous user, restrict root user access to the local machine and remove the test database. At the end the script will reload the privilege tables ensuring that all changes take effect immediately.

All steps are explained in detail and it is recommended to answer “Y” (yes) to all questions.

To connect to the MariaDB server through the terminal we can use the MariaDB client.

To log in to the MariaDB server as the root user type:

mysql -u root -p


You will be prompted to enter the root password you have previously set when the mysql_secure_installation script was run.

Once you enter the password you will be presented with the MariaDB shell as shown below:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 49
Server version: 10.1.29-MariaDB-6 Ubuntu 18.04

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Fix MariaDB Plugin ‘Unix_socket’ Is Not Loaded Error On Ubuntu 18.04

Step 1: Add Unix Authentication Plugin To MariaDB Config

If this issue relates to Unix authentication plugin, the quickest fix is to open MariaDB configuration file and add a single line into the file and save. Run the commands below to open MariaDB default configuration file.

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

Then add the line below [mysqld] section.

plugin-load-add = auth_socket.so

After adding the line into the file, run the commands below to restart MariaDB

sudo systemctl restart mariadb.service

Next, try to sign  on to the database again.

sudo mysql -u root

Running the commands above should logon onto the database without password prompt… that’s because it’s using unix socket authentication.

Step 2: Change To Standard Authentication

Step 1 should be enough to get you into MariaDB server… and should work as long as you keep using unix socket authentication. However, other apps and services like phpMyAdmin that depend on standard password authentication will stop working when you enable socket authentication for the root user.

A typical error you’ll get when unix socket authentication is being used will be  ERROR 1698 (28000): Access denied for user ‘root’@’localhost’

So now that you’ve access to the database, run the commands below to disable unix socket authentication for the root user…

use mysql;
update user set plugin='' where User='root';
flush privileges;

Exit out and you’re done. Now you should be able to logon to the server with standard password authentication.

That’s it!


  • https://linuxize.com/post/how-to-install-mariadb-on-ubuntu-18-04/
  • https://websiteforstudents.com/fix-mariadb-plugin-unix_socket-is-not-loaded-error-on-ubuntu-17-04-17-10/

Leave a comment

November 2018