Getting started with MariaDB Different Linux distributions use different formats and packaging tools. The table below lists the best-known packaging tools. And for this tutorial, we will cover installing MariaDB…

Getting started with MariaDB

Different Linux distributions use different formats and packaging tools. The table below lists the best-known packaging tools. And for this tutorial, we will cover installing MariaDB through:

  • apt-get
  • yum
  • dnf
Distributions Format Command (Tool)
Ubuntu, Debian, Linux Mint, Raspbian (other Debian distributions) .deb Advanced Packaging Tool (apt) Mostly used commands apt-get, dpkg
>=Fedora 22 (other RedHat distributions) .rpm Dandified Yum (dnf)
CentOS, <=Fedora 21 .rpm Yellowdog Updater Modified (yum)

Installation process

Installing MariaDB with apt-get

  1. Update you repository:
    (you will be prompted to enter the SUDO password – “[sudo] password for username: ” just enter password)
  2. Upgrade your repository:
    (Press Y to continue on the next prompt – “Do you want to continue? [Y/n]” press “y” and then “Enter” )
  3. Install MariaDB:
    (the next prompt is “Do you want to continue? [Y/n]” press “y” and then “Enter” )
    This is where you set the root pass for the MariaDB “root” user. It is mandatory to create one. When you are ready to continue just press “Enter”. You’ll then enter the same password and hit “Enter” again.
  4. Stop MariaDB that is already running :
  5. Create MariaDB database directory structure:
  6. Start MariaDB:
  7. Define settings and clear default tables:
    (you will  need to enter the MariaDB root user’s password to continue – see step 3) This opens a dialogue for additional settings, that you will answer depending on your use case:
Prompts Testing Production
Change the root password? [Y/n] Y/N Y/N
Remove anonymous users? [Y/n N Y
Disallow root login remotely? [Y/n N Y
Remove test database and access to it? Y Y
Reload privilege tables now? [Y/n] Y Y

Maria DB has now been installed on your computer and is up and running.

Installing MariaDB with dnf

  1. Update you repository:
    (you will be prompted something like“[sudo] password for lordpavel: ” just enter password)
  2. Upgrade your repository:
    (you will be prompted something like “Is this ok [y/N]” press “y” and then “Enter” )/
  3. Install MariaDB:
    (you will be prompted something like “Is this ok [y/N]” press “y” and then “Enter” )
  4. Start MariaDB:
  5. Define settings and clear default tables:
    (you will be prompted something like “Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: ” This opens a dialogue for additional settings, that you will answer depending on your use case:
Prompts Testing Production
Please set the password for root here. New password: PASSWORD PASSWORD
Re-enter new password: PASSWORD PASSWORD
Remove anonymous users? [Y/n] N Y
Disallow root login remotely? [Y/n] N Y
Remove test database and access to it? [Y/n] Y Y
Reload privilege tables now? [Y/n] Y Y

Maria DB has now been installed on your computer and is up and running.

Installing MariaDB using yum

    1. Update you repository:
      lordpavel@f2machine:~$ sudo yum update
      (you will be prompted something like“[sudo] password for lordpavel: ” just enter password)
    2. Install MariaDB:
      lordpavel@f2machine:~$ sudo yum -y install mysql-server mysql
      (you will be prompted something like “Is this ok? [Y/n]” press “y” and then “Enter” )
    3. Create MariaDB database directory structure:
      lordpavel@f2machine:~$ sudo mysql_install_db
    4. Start MariaDB:
      lordpavel@f2machine:~$ sudo systemctl start mysql
    5. Define settings and clear default tables:
      lordpavel@f2machine:~$ sudo mysql_secure_installation (you will be prompted something like “Enter current password for root:” default one is blank so just press “Enter” to continue. Fill in the following dialogue:
Prompts Testing Production
Set root password? Y/n Y/n
Remove anonymous users? [Y/n] N Y
Disallow root login remotely? [Y/n] N Y
Remove test database and access to it? [Y/n] Y Y
Reload privilege tables now? [Y/n] Y Y

Maria DB has now been installed on your computer and is up and running.

What next?

Now that you installed MariaBD on your maching using apt-get, dnf or yum, try running some of the below commands and experiment with the output:

Command Description
man mysql It will show you all commands
mysql -V Shows the current version of MariaDB installed on your system
mysql -p You will be asked to enter your root password and then you will get MariaDB “terminal” (you leave this terminal by typing “exit”)
sudo service mysql start Starts MariaDB process
sudo service mysql stop Stops MariaDB process
sudo service mysql restart Restarts MariaDB process
sudo service mysql status Shows the current status of MariaDB process

Website: