Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Databases»MariaDB»How To Install MariaDB 10 on Ubuntu 18.04 And 16.04 LTS

    How To Install MariaDB 10 on Ubuntu 18.04 And 16.04 LTS

    By RahulJune 7, 20223 Mins Read

    MariaDB ia an enhanced, drop-in replacement for MySQL. MariaDB can be a better choice for choice for database professionals looking for a robust, scalable, and reliable SQL server. MariaDB has a number of updated features over MySQL. Use below links to read features comparison between MariaDB and MySQL

    Advertisement

    mariadb-banner

    This article will help you to Install MariaDB in Ubuntu 18.04 and 16.04 LTS and Other Systems using the Apt package manager, For older versions use the Apt-get command.

    Step 1 – Backup Databases

    MariaDB 10.2 has been released with various upgrades and configuration changes than previous releases. So, If you have already run an older MariaDB version, It’s recommended to take all databases backups before upgrading.

    You can back up all your databases using the below single command.

    mysqldump -u root -p --all-databases > all-db.sql
    

    Step 2 – Add Apt Repository

    You can find the MariaDB Apt configuration file from the official website. Import the package singin key for MaraiDB packages on your system.

    sudo apt install software-properties-common
    sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
    

    After this, create a new Apt configuration file for MariaDB with the following command. You can use any text editor than vim.

    sudo vim /etc/apt/sources.list.d/mariadb.list
    

    And add the following values to the configuration file as per your Ubuntu version. To check your Ubuntu system version run ‘lsb-release -a’ command.

    For Ubuntu 18.04 “Bionic”

    deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main
    deb-src http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu bionic main
    

    For Ubuntu 16.04 “Xenial”

    deb [arch=amd64,arm64,i386,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu xenial main
    deb-src http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu xenial main
    

    For Other Ubuntu Versions

    For other versions of Ubuntu. Click here to find suitable repository for your system.

    Step 3 – Install MariaDB in Ubuntu

    After adding the repository to your system and use the following commands to install MariaDB-server on your Ubuntu system. This will remove any previous version of MariaDB packages and install the latest packages on the system. Make sure you have proper backups of databases before running the below commands.

    sudo apt update
    sudo apt install mariadb-server
    

    While installing MariaDB using the above command installer will prompt for the MariaDB root account password twice like the below snapshot.

    install mariadb 10

    Step 4 – Login To MariaDB

    After completing installation you can connect to MariaDB using following command. When prompted, use the password entered during installation of MariaDB.

    mysql -u root -p 
    
    Enter password:
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 8
    Server version: 10.2.6-MariaDB-10.2.6+maria~xenial mariadb.org binary distribution
    
    Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]>
    

    Step 5 – Manage MariaDB Service

    Some times we need to stop or start MariaDB service. Use the following commands to stop, start, check status and restart MariaDB servic.

    sudo systemctl stop mysql.service      # To Stop MariaDB service 
    sudo systemctl start mysql.service     # To Start MariaDB service 
    sudo systemctl status mysql.service    # To Check MariaDB service status 
    sudo systemctl restart mysql.service   # To Stop then Start MariaDB service 
    

    database dbms mariadb MySQL
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Securing MySQL Database with Limited User Permissions

    How to Install and Secure MongoDB on Ubuntu 22.04

    How to Install LAMP Stack on RHEL & CentOS Stream 9

    View 5 Comments

    5 Comments

    1. Johnson on December 1, 2021 8:33 am

      I think this tutorial is great but there is a problem with repository. I think it’s better to use the one from main repo instead of third party like digitalocean.

      Reply
    2. David on June 11, 2018 8:11 pm

      I download and upgrade the repository but when I tried to install
      MariaDB 10.3 the installation was failed. Here is the log (in spanish):

      [email protected]:~$ sudo apt-get install mariadb-server mariadb-clientLeyendo lista de paquetes… Hecho
      Creando árbol de dependencias

      Leyendo la información de estado… Hecho
      No se pudieron instalar algunos paquetes. Esto puede significar que
      usted pidió una situación imposible o, si está usando la distribución
      inestable, que algunos paquetes necesarios aún no se han creado o se
      han sacado de «Incoming».
      La siguiente información puede ayudar a resolver la situación:

      Los siguientes paquetes tienen dependencias incumplidas:
      mariadb-client : Depende: mariadb-client-10.3 (>= 1:10.3.7+maria~bionic) pero no va a instalarse
      mariadb-server : Depende: mariadb-server-10.3 (>= 1:10.3.7+maria~bionic) pero no va a instalarse
      E: No se pudieron corregir los problemas, usted ha retenido paquetes rotos.

      How can I upgrade MariaDB to 10.3?

      Thanks!!

      David.

      Reply
    3. rajnish on April 10, 2015 6:51 am

      W: Failed to fetch 404 Not Found
      repo link is not working , see below error ,

      i am running it on ubuntu 12.04 , trying to install mariadb 10.0

      W: Failed to fetch 404 Not Found

      W: Failed to fetch 404 Not Found

      E: Some index files failed to download. They have been ignored, or old ones used instead.

      Reply
      • Rahul on April 10, 2015 1:25 pm

        Thanks Rajnish,

        We have updated article with latest repository urls.

        Reply
        • Adam on November 6, 2019 10:30 am

          This doesnt work, the mirrors list you added is out of date. Please update!

          Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • How to List Manually Installed Packages in Ubuntu & Debian
    • 10 Bash Tricks Every Developer Should Know
    • How to Validate Email Address in JavaScript
    • Firewalld: Common Firewall Rules and Commands
    • 12 Apk Commands in Alpine Linux Package Management
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.