How to Remove MySQL Completely from Linux

As a DBA sometimes we get the task to remove MySQL installation from Server. We have to uninstall MySQL completely from the system and erase all settings of old install.

First, we need to Check that mysql is installed and server is running or stop.

Check the service is running or not.

[root@DBATrainings ~]# ps -ef | grep mysql

[root@DBATrainings ~]# sudo systemctl status mysqld

Before going to uninstall or remove the MySQL we need to stop MySQL Service.

Stop mysql service

[root@DBATrainings ~]# sudo service mysqld stop

Uninstall MySQL Packages installed on your server.

[root@DBATrainings ~]# sudo yum remove mysql mysql-server

Remove MySQL Directory from operating system.

Now we are ready to remove MySQL data directory from system which by default exists at /var/lib/mysql. If you didn’t find this, It may be changed to some other place, which you can find in my.cnf file with variable datadir. Delete the /var/lib/mysql directory from the system

[root@DBATrainings ~]# ls /var/lib/mysql/

[root@DBATrainings ~]# rm -rf /var/lib/mysql/

Now let me check and assure the file is not available.

[root@DBATrainings ~]# ls /var/lib/mysql/

Final step we need to remove the configuration file as well.

[root@DBATrainings ~]# sudo rm -rf /etc/mysql/

[root@DBATrainings ~]# sudo rm -rf /etc/my.cnf

[root@DBATrainings ~]# sudo rm -rf /etc/usr/share/mysql

[root@DBATrainings ~]# sudo rm -rf /etc/usr/share/mysql/charsets



For More Details, you can reach us using the below link. 

YOUTUBE: HTTPS://WWW.YOUTUBE.COM/DBATRAINING

TELEGRAM APP: HTTPS://T.ME/DBAHELP

WEBSITE: HTTP://DBATRAININGS.COM/ EMAIL: INFO@DBATRAININGS.COM

LINKEDIN: HTTPS://WWW.LINKEDIN.COM/IN/DBATRAININGS/ FB PAGE: HTTPS://WWW.FACEBOOK.COM/DBATRAININGS/ FB GROUP: HTTPS://WWW.FACEBOOK.COM/GROUPS/402208687087064/



59 views0 comments

Recent Posts

See All

How to set cursor movement in oracle SQL

While you are working on SQL*Plus and RMAN on Linux environment and you did some mistake and you want to edit your query it won’t work by default. There is way to configure it. The rlwrap (readline wr

How to resolve Backspace key issue in sqlplus.

Backspace key does not work in sqlplus. It's not a issue form Oracle. This is a terminal type issue. echo $TERM stty -a and see if you have done anything special with the backspace key. I hope it’s wo

ADDRESS :

701, Linden, Rosalie Complex Khadakpada, Kalyan (W) Mumbai, Maharashtra 421301)

CONTACT US :

LOCATION :

QUICK LINKS :

SUBSCRIBE HERE :

Don’t Miss a Lecture. Subscribe Today. 

+919322846017  &   +919867493019

EMAIL: 

telegram-512.png

© 2021 DBA Trainings. Proudly Managed By SPIROSOFT IT SOLUTIONS

  • Grey LinkedIn Icon
  • Grey YouTube Icon
  • Grey Twitter Icon
  • Grey Facebook Icon