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.7 on Ubuntu 20.04

    How to Install MariaDB 10.7 on Ubuntu 20.04

    By RahulMay 20, 20204 Mins ReadUpdated:April 19, 2022

    MariaDB is an open-source relational database server. Which is made by the original developers of MySQL. MariaDB intended to maintain high compatibility with the MySQL server, APIs, and commands.

    Advertisement

    This tutorial will help you to install the MariaDB on Ubuntu 20.04 LTS system.

    Prerequisites

    • Running Ubuntu 20.04 system
    • Login access with root or sudo privileged account

    Step 1 – Setup Repository

    The Default packages repositories contain old versions of the MariaDB server. So, it will be good to use the official repository, which provides the latest version of packages.

    First, add the package signing key to your system by running commands:

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

    Then, create a apt configuration file on your Ubuntu system. To create file run command:

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

    Add the below snippet

    # MariaDB 10.4 Repository
    deb [arch=amd64] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu focal main
    deb-src http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.4/ubuntu focal main
    

    Save file and close.

    Step 2 – Install MariaDB on Ubuntu

    The official MariaDB repository contains the latest version of MariaDB server packages.

    Once you added the package repository, run the following commands to install MariaDB server packages and required dependencies.

    sudo apt update
    sudo apt install mariadb-server
    

    The above command will install the MariaDB server, client tools, and other required packages on your system.

    Step 3 – Post Installation Setup

    MariaDB package provides a command-line utility to complete post-installation steps. This includes configuring a password for the root user and removing unnecessary databases from the default installation.

    To run the MariaDB post installation wizard, type:

    sudo mysql_secure_installation
    

    A wizard will prompt for some inputs to set up the MariaDB root user password. Secure your MariaDB installation by removing anonymous users, disabling root login from a remote host, and removing test databases.

    A preferred choice is to say yes (‘y’) for all the question:

    • Enter current password for root (enter for none): [ JUST PRESS ENTER ]
    • Set root password? [Y/n] y
    • New password: [ ENTER A SECURE PASSWORD ]
    • Re-enter new password: [ CONFIRM YOUR PASSWORD ]
    • Remove anonymous users? [Y/n] y
    • Disallow root login remotely? [Y/n] y
    • Remove test database and access to it? [Y/n] y
    • Reload privilege tables now? [Y/n] y

    Step 4 – Connect to MariaDB

    MariaDB packages provide a command-line utility to connect database servers via the command line. Where you can completely manage your database server.

    To connect MariaDB server run below command on terminal:

    mysql -u root -p
    

    Enter the password for the root account configured in the above step.

    Enter password:
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 57
    Server version: 10.4.13-MariaDB-1:10.4.13+maria~focal-log mariadb.org binary distribution
    
    Copyright (c) 2000, 2018, 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

    The latest version of Ubuntu systems uses systemd to manage services. You can use the following commands to manage the MariaDB service on your system.

    sudo systemctl start mariadb         # To start service 
    sudo systemctl stop mariadb          # To stop service 
    sudo systemctl status mariadb        # To check status of service 
    sudo systemctl restart mariadb       # To stop and then start service 
    

    Step 6 – Create Database and User (Optional)

    This is an optional step for you. The below commands help you to create a database, a user, and assign privilege to the user on the database.

    To use the below commands, first, you must be connected to the MariaDB server via the command line.

    1
    2
    3
    4
    CREATE DATABASE mydb;
    CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'my_secure_password';
    GRANT ALL ON mydb.* TO 'myuser'@'localhost';
    FLUSH PRIVILEGES;

    Conclusion

    In this tutorial, you have learned about to install MariaDB on Ubuntu Linux system. Next, you can install phpMyAdmin to administer MySQL server via web based interface.

    database mariadb RDMS
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Installing MySQL 8.0 on Amazon Linux 2

    How To Install MySQL 8 on Amazon Linux 2

    (Resolved) Unknown collation: utf8mb4_unicode_520_ci

    How to Install MariaDB on Ubuntu 22.04

    How to Install MariaDB on Ubuntu 22.04

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Error: EACCES: permission denied, scandir (Resolved)
    • How To Install Python 3.11 on Ubuntu 22.04 / 20.04
    • How to Install Python 3.11 on Amazon Linux 2
    • An Introduction to the “./configure” Command: Compiling Source Code in Linux
    • How to Install PHP 8.x on Pop!_OS
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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