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/



49 views

ADDRESS :

LOCATION :

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

CONTACT US :

+919322846017  &   +919867493019

EMAIL: 

QUICK LINKS :

SUBSCRIBE HERE :

Don’t Miss a Lecture. Subscribe Today. 

telegram-512.png

© 2019 DBA Trainings. Proudly Managed By Pearl Organisation

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