• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to Completely Remove and Install MariaDB 10.1.39v on CentOS 7.6

  • 00:54 rpm -qa | grep "MariaDB"
  • 01:02 cd /etc/yum.repos.d/
  • 01:19 yum-config-manager --disable MariaDB
  • 01:32 yum remove "MariaDB*" -y
  • 01:45 rm -rf /etc/my.cnf
  • 01:55 rm -rf /var/lib/mysql
  • 02:14 userdel -r mysql
  • 02:24 mysql -u root -p
  • 02:34 systemctl status mariadb
  • 02:53 yum-config-manager --enable MariaDB
5597

Removing and Installing MariaDB on CentOS 7.6

Prerequisite:

1)Check the installed rpm packages of MariaDB.

2)Go the yum repositories location.

3)Disable the MariaDB repo if you have configured a repository, else skip this step.

4)Remove the Packages as follows:

Configuration file

Data Directory

Mysql user

5)Check whether could you login to the MariaDB database securely.

6)Check the Service Of MAriaDB.

Deletion Of MAriaDB packages

And now, list all the installed MariaDB packages.

[root@linuxhelp ~]# rpm -qa | grep "MariaDB"
MariaDB-server-10.1.39-1.el7.centos.x86_64
MariaDB-common-10.1.39-1.el7.centos.x86_64
MariaDB-client-10.1.39-1.el7.centos.x86_64
MariaDB-shared-10.1.39-1.el7.centos.x86_64

And then, go to the location of yum repositories list.

[root@linuxhelp ~]# cd /etc/yum.repos.d/

List the contents inside the repository list.

[root@linuxhelp yum.repos.d]# ll
total 92
-rw-r--r--. 1 root root 1664 Nov 23 18:46 CentOS-Base.repo
-rw-r--r--. 1 root root 1309 Nov 23 18:46 CentOS-CR.repo
-rw-r--r--. 1 root root  649 Nov 23 18:46 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root  314 Nov 23 18:46 CentOS-fasttrack.repo
-rw-r--r--. 1 root root  630 Nov 23 18:46 CentOS-Media.repo
-rw-r--r--. 1 root root 1331 Nov 23 18:46 CentOS-Sources.repo
-rw-r--r--. 1 root root 5701 Nov 23 18:46 CentOS-Vault.repo
-rw-r--r--  1 root root  951 Oct  2  2017 epel.repo
-rw-r--r--  1 root root 1050 Oct  2  2017 epel-testing.repo
-rw-r--r--  1 root root  139 May  8 17:33 MariaDB.repo
-rw-r--r--  1 root root  446 Mar  8 13:04 remi-glpi91.repo
-rw-r--r--  1 root root  446 Mar  8 13:04 remi-glpi92.repo
-rw-r--r--  1 root root  446 Mar  8 13:04 remi-glpi93.repo
-rw-r--r--  1 root root  446 Mar  8 13:04 remi-glpi94.repo
-rw-r--r--  1 root root  855 Mar  8 13:04 remi-modular.repo
-rw-r--r--  1 root root  456 Mar  8 13:04 remi-php54.repo
-rw-r--r--  1 root root 1314 Mar  8 13:04 remi-php70.repo
-rw-r--r--  1 root root 1314 Mar  8 13:04 remi-php71.repo
-rw-r--r--  1 root root 1314 Apr 15 11:07 remi-php72.repo
-rw-r--r--  1 root root 1314 Mar  8 13:04 remi-php73.repo
-rw-r--r--  1 root root 2605 Mar  8 13:04 remi.repo
-rw-r--r--  1 root root  750 Mar  8 13:04 remi-safe.repo

Disable the MariaDB repo by running the following command.

[root@linuxhelp yum.repos.d]# yum-config-manager --disable MariaDB
Loaded plugins: fastestmirror, langpacks
============================== repo: Mariadb ===============================
[Mariadb]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
cache = 0
cachedir = /var/cache/yum/x86_64/7/Mariadb
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage = 
.
.
.
.
throttle = 0
timeout = 30.0
ui_id = Mariadb
ui_repoid_vars = releasever,
   basearch
username = 

You can now remove the MariaDB rpm packages.

[root@linuxhelp yum.repos.d]# yum remove "MariaDB*" -y
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package MariaDB-client.x86_64 0:10.1.39-1.el7.centos will be erased
---> Package MariaDB-common.x86_64 0:10.1.39-1.el7.centos will be erased
---> Package MariaDB-server.x86_64 0:10.1.39-1.el7.centos will be erased
---> Package MariaDB-shared.x86_64 0:10.1.39-1.el7.centos will be erased
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: perl-DBD-MySQL-4.023-6.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: perl-DBD-MySQL-4.023-6.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-7.el7.x86_64
--> Running transaction check
.
.
.
.
..
Removed:
  MariaDB-client.x86_64 0:10.1.39-1.el7.centos                              
  MariaDB-common.x86_64 0:10.1.39-1.el7.centos                              
  MariaDB-server.x86_64 0:10.1.39-1.el7.centos    
Complete!

Remove the configuration file of MariaDB.

[root@linuxhelp yum.repos.d]# rm -rf /etc/my.cnf

Remove the data directory of MariaDB.

[root@linuxhelp yum.repos.d]# rm -rf /var/lib/mysql

Delete the mysql user in /etc/passwd.

[root@linuxhelp yum.repos.d]# grep mysql /etc/passwd
mysql:x:27:27:MariaDB Server:/var/lib/mysql:/sbin/nologin
[root@linuxhelp yum.repos.d]# userdel -r mysql
userdel: mysql mail spool (/var/spool/mail/mysql) not found
userdel: mysql home directory (/var/lib/mysql) not found
[root@linuxhelp yum.repos.d]# grep mysql /etc/passwd

And then, login to the MariaDB database to verify the removal of secure installation.

[root@linuxhelp yum.repos.d]# mysql -u root -p
bash: /usr/bin/mysql: No such file or directory

Check the status of MariaDB.

[root@linuxhelp yum.repos.d]# systemctl status mariadb
'Unit mariadb.service could not be found.

Installation of MariaDB

Enable the MariaDB repo to install the server.

[root@linuxhelp yum.repos.d]# yum-config-manager --enable MariaDB
Loaded plugins: fastestmirror, langpacks
============================== repo: Mariadb ===============================
[Mariadb]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
cache = 0
cachedir = /var/cache/yum/x86_64/7/Mariadb
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
.
.
..
sslclientcert = 
sslclientkey = 
sslverify = True
throttle = 0
timeout = 30.0
ui_id = Mariadb
ui_repoid_vars = releasever,
   basearch
username = 

You shall now install MariaDB by executing the following command.

[root@linuxhelp yum.repos.d]# yum install MariaDB-server MariaDB-client -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.dhakacom.com
 * epel: www.ftp.ne.jp
 * extras: mirror.dhakacom.com
 * remi-php72: remi.schlundtech.de
 * remi-safe: remi.schlundtech.de
 * updates: mirror.nbrc.ac.in
Resolving Dependencies
.
.
.
Dependency Installed:
  MariaDB-common.x86_64 0:10.1.39-1.el7.centos            boost-program-options.x86_64 0:1.53.0-27.el7            galera.x86_64 0:25.3.26-1.rhel7.el7.centos            jemalloc.x86_64 0:3.6.0-1.el7           

Replaced:
  mariadb.x86_64 1:5.5.60-1.el7_5                                   mariadb-libs.x86_64 1:5.5.60-1.el7_5                                   mariadb-server.x86_64 1:5.5.60-1.el7_5                                  

Enable the service of MariaDB.

[root@linuxhelp ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

Start the service of MariaDB.

[root@linuxhelp ~]# systemctl start mariadb

Check the status of MariaDB.

[root@linuxhelp ~]# systemctl status mariadb
● mariadb.service - MariaDB 10.1.39 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           └─migrated-from-my.cnf-settings.conf
Active: active (running) since Wed 2019-05-08 17:36:28 IST; 11s ago

Secure the MariaDB through the below installation method

[root@linuxhelp ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
Change the root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Therefore, we have successfully removed the MariaDB package on CentOS completely and installed it successfully on CentOS 7.6

Tags:
matthew
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is the MariaDB On CentOS 7.6?

A

Mariadb is a database that stores the information in the form of tables.

Q

What is the user that mariadb has by default on centOS 7.6?

A

mysql is the MAriadb user has by default on centos 7.6

Q

What is the command to delete the mariadb user on centos 7.6?

A

userdel -r mysql is the command to delete the mariadb user on centos 7.6

Q

Why was MariaDB created ?

A

It was primarily developed due to concerns that arose when MySQL was acquired by ORACLE Inc.MAriaDB is a general purpose DBMS engineered with extensible architecture to support a broad set of use cases via pluggable storage engines.

Q

Are the commands in Mariadb similar in MYSQL?

A

Yes.the mariadb commands are similar in mysql

Related Tutorials in How to Completely Remove and Install MariaDB 10.1.39v on CentOS 7.6

Related Tutorials in How to Completely Remove and Install MariaDB 10.1.39v on CentOS 7.6

How To Install AnyDesk on Centos 7
How To Install AnyDesk on Centos 7
Apr 2, 2018
How to install Tiki Wiki CMS Groupware on CentOS 7
How to install Tiki Wiki CMS Groupware on CentOS 7
May 31, 2018
How to install PHP ImageMagick on CentOS 7
How to install PHP ImageMagick on CentOS 7
Nov 4, 2017
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
How to Upgrade and Downgrade the PHP Versions on CentOS 7.6
Jun 4, 2019
How to install Apache from Source Code on CentOS 7
How to install Apache from Source Code on CentOS 7
Oct 21, 2017
How to enable or disable repositories in CentOS
How to enable or disable repositories in CentOS
Mar 28, 2018
How to install AWStats on CentOS 7
How to install AWStats on CentOS 7
Dec 8, 2017
How to install Apache JMeter in CentOS 7
How to install Apache JMeter in CentOS 7
Mar 24, 2017

Related Forums in How to Completely Remove and Install MariaDB 10.1.39v on CentOS 7.6

Related Forums in How to Completely Remove and Install MariaDB 10.1.39v on CentOS 7.6

CentOS
connor class=
How To Completely Remove Apache package On CentOS 7.6
May 14, 2019
CentOS
ceriaimmaculate class=
setfacl : command not found
Jan 3, 2018
CentOS
mason class=
Error getting authority: Error initializing authority: Could not connect: No such file or directory (g-io-error-quark, 1)
Nov 20, 2018
CentOS
landon class=
Command to find SNMP Version
May 28, 2018
CentOS
arjitharon class=
cannot start minio service help
Mar 10, 2018
Apache tomcat
AadrikaAnshu class=
Cannot find ./catalina.sh The file is absent or does not have execute permission This file is needed to run this program
Jun 17, 2019
gitlab
caden class=
Insufficient space in download directory /var/cache/yum/x86_64/6/base/packages
Jul 22, 2019
OpenVAS
frank class=
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was 14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Dec 20, 2018
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Lucas ?
Various options in Top command

Am using Top command only to view the load average, what are the various options in Top command..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.