Monday, November 25, 2013

How to Remove MySQL from server completely centos red hat

There maybe a case when you want to completely remove mysql from your server but before un-installing mysql from server make sure you have the backup of databases of mysql the default location of databases is /var/lib/mysql 

To un-install mysql from server follow the steps below.

Step 1: Uninstall Packages

First we need to uninstall mysql packages using following command.


  • yum remove mysql mysql-server

Step 2: Check it there are still packages in the server.
rpm -qa | grep mysql

If you don't get ant thing in the output that means every thing is fine, If you get the output as below proceed with the next step.

========
[root@server ~]# rpm -qa | grep mysql
mysql-5.0.95-5.el5_9
mysql-server-5.0.95-5.el5_9 
========

mysql-5.0.95-5.el5_9 and mysql-server-5.0.95-5.el5_9 are packages which are still installed in the server they maybe different in your case remove them by using the commands below.
  • yum remove mysql-5.0.95-5.el5_9
  • yum remove mysql-server-5.0.95-5.el5_9
Step 3: Rename MySQL Directory

Now we need to just rename existing mysql directory with other name. We can also delete that directory but rename is better to keep a copy of existing files.


  • mv /var/lib/mysql /var/lib/mysql_backup

Thats All

No comments:

Post a Comment

Do Write about the Blog and Welcome to the world where open source is every thing :-)