• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
sharadchhetri.com

sharadchhetri.com

Linux,Cloud Computing And DevOps

  • Home
  • Linux
  • CloudComputing
    • Introduction Cloud Computing
    • Amazon AWS
  • Free E-Books
  • About Me

How to install Mariadb 10.4 server on CentOS 8 / RHEL 8

June 14, 2020 by Sharad Chhetri Leave a Comment

Do you want to know how to install Mariadb 10.04 server on CentOS 8/RHEL 8 ? This post will help you to install MariaDB server. MariaDB is now defacto RDBMS in RHEL/CentOS after its seperation from the MySQL. We have already written other post on Mariadb Server, hence we will directly go to installation section.

In this post, we will do all the steps by creating the shell script and executing it. When we do our task by using scripts, it automates the task and quite faster then manual efforts.

Before we jump into installation section, we would like to strongly suggest to read the release notes of MariaDB 10.4 server.

Steps To Install MariaDB 10.4 Server on CentOS 8/RHEL 8

First we will create a simple bash script for installing the MariaDB Server.

Step 1: Create a file for creating bash script

vi install_mariadb_10.04_centos8.sh

Copy-Paste and save the given below content in the file.

#/bin/bash
#
# Install MariaDB Server version 10.4 on CentOS 8.
# Blog: https://sharadchhetri.com

# Declare a variable for new mariadb root password. If it is not given, then script won't run and will show help.
#

_root_new_passwd=${1?Require to give new root password, use -n }

# create new yum mariadb repo file and move to /etc/yum.repos.d dir
cat <mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.4/centos8-amd64
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
sudo mv mariadb.repo /etc/yum.repos.d/

#Install MariaDB Server
sudo dnf install -y MariaDB-server

# Enable as well as Start the mariadb service
sudo systemctl enable --now mariadb

## Resetting root password, removing database called 'test' and any related tables to it
sudo mariadb <<_EOF_
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD("$_root_new_passwd");
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
FLUSH PRIVILEGES;
FLUSH PRIVILEGES;
_EOF_
###
echo "Installation finished"

Step 2: Change the permission of the script file.

chmod +x install_mariadb_10.04_centos8.sh

Step 3: Now run the script. You should give a new root password of MariaDB in first argument.

sh install_mariadb_10.04_centos8.sh MyNewRootPassword

Summary of install_mariadb_10.04_centos8.sh bash script

1. It create the mariadb yum repo file.
2. Then install the mariadb server by dnf command.
3. Then it enable and start the mariadb service.
4. At the end, it reset the root password. By default it is blank root password. As well as remove the 'test' database.

Login to MariaDB Server

Run the following command to login as root user in MariaDB server. Give the password which you have used in Step 3.

mariadb -u root -p

OR

mysql -u root -p

Output From Our System:

[sharad@mariadb01 ~]$ mariadb -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.4.13-MariaDB MariaDB Server

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)]> 

Manage MariaDB Service

1. Check status of MariaDB service.

sudo systemctl status mariadb

2. Start the MariaDB service.

sudo systemctl start mariadb

3. Stop the MariaDB service.

sudo systemctl stop mariadb

4. Re-start the MariaDB service.

sudo systemctl restart mariadb

5. Enable the MariaDB service. It start the service at system booting time.

sudo systemctl enable mariadb

6. Disable the MariaDB service. Means do not let service to start at booting time.

sudo systemctl disable mariadb

Do'nt be greedy, share the knowledge!

  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)

Related

Filed Under: Linux Tagged With: bash script, MariaDB Server

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow Us

  • Facebook
  • Twitter
  • GitHub
  • YouTube

Recent Posts

  • How to install Java (OpenJDK) on Ubuntu Linux
  • How to install Groovy on Ubuntu 20.04 LTS
  • How to Disable selinux in Red Hat or CentOS
  • How to remove date from WordPress Post URL
  • How to install Mariadb 10.4 server on CentOS 8 / RHEL 8

Top Posts & Pages

  • How to delete mail queue in Postfix
  • How to set hostname and FQDN on CentOS 7 and RHEL 7
  • How to start / stop / restart / reload iptables on CentOS 7 / RHEL 7
  • How to install MySQL Server 5.6 on CentOS 7 / RHEL 7
  • How to fix read only USB pen drive in Ubuntu
  • How to create Jenkins user by command line and GUI
  • How to setup Jenkins Credentials for Git repo access
  • How to find absolute path of command on Linux / Unix : which command
  • make command not found in linux CentOS Red Hat ubuntu Debian
  • 4 different commands to check the load average in linux

DevOps Posts

  • vagrant cloud flow

    Install Vagrant on Ubuntu and create first VM

  • git jenkins credential github

    How to setup Jenkins Credentials for Git repo access

  • terraform

    how to install terraform in Linux : CentOS-Ubuntu

  • docker image

    How to create Ubuntu docker base image

  • Install Ansible on Ubuntu / CentOS / RHEL

Footer

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Sharad Chhetri is an experienced Linux - Cloud Engineer & freelancer. Working on Open Source Technology since RHEL 4.0 (Red Hat Enterprise Linux). He loves sharing the knowledge which earned from real scenarios. Don't be surprised if you find him in technology seminars and meetup groups. You can contact him on email for freelance projects at admin@sharadchhetri.com. Read More…

Tags

Amazon AWS apache automation awk bash script CentOS centos 7 debian devops docker freebsd ftp ghost git grep hostname jenkins kvm linux linux command linux commands MariaDB Server mysql Nagios nginx Octopress owncloud Owncloud 6 php postfix postgres python Red Hat rpm sed selinux ssh swap ubuntu user management vagrant varnish virtualbox vsftp wordpress

Recent Comments

  • Ali on How to delete mail queue in Postfix
  • Mehar on How to install Java (OpenJDK) on Ubuntu Linux
  • Ramone Burrell on How to fix read only USB pen drive in Ubuntu
  • Pera on How to fix read only USB pen drive in Ubuntu
  • Ubuntu on How to fix read only USB pen drive in Ubuntu
  • Nitin Sharma on Install and configure rsyslog Centralized logging server in CentOS 6.5
  • Sharad Chhetri on Install and configure rsyslog Centralized logging server in CentOS 6.5
  • nitin on Install and configure rsyslog Centralized logging server in CentOS 6.5

Copyright © 2009 - 2021 · All Rights Reserved sharadchhetri.com · · Privacy Policy ·
· sitemap.xml · ·The content is copyrighted to sharadchhetri.com and may not be reproduced on other websites without our permission. ·

Copyright © 2021 · Genesis Sample on Genesis Framework · WordPress · Log in