Uninstall MySQL Packages from Linux / Red-hat / Oracle Linux System
Step By Step Uninstall MySql Database RPM packages from Linux operating system.
STEP-1: Remove dependent packages
If your system has packages which depend on MySQL database or package, Please remove them in before uninstall mysql database. If those packages are required and/or cannot be removed, you should not remove MySQL.
STEP-2: Stop the server
Stop the MySQL Database on server if it is running.
To stop MySql database execute below command.
shell> su -
shell# service mysql stop
Note: The name of a service may vary depending on your system. Run the command "service --status-all" to determine the name of the service.
STEP-3: Remove RPM packages.
shell> rpm -qa | grep -i mysql # verifying the actual package names
shell> su -
shell# rpm -e MySQL-server-advanced-5.5.18-1.rhel5
shell# rpm -e MySQL-client-advanced-5.5.18-1.rhel5
Please use the -qa option for the rpm command to determine the exact names of the packages. Then remove the package using the -e option.
Example of rpm -qa and rpm -e:
[shell]# rpm -qa | grep -i mysql
MySQL-shared-advanced-5.6.20-1.el6.x86_64
perl-DBD-MySQL-4.023-6.el7.x86_64
MySQL-test-advanced-5.6.20-1.el6.x86_64
MySQL-server-advanced-5.6.20-1.el6.x86_64
MySQL-devel-advanced-5.6.20-1.el6.x86_64
MySQL-client-advanced-5.6.20-1.el6.x86_64
MySQL-shared-compat-advanced-5.6.20-1.el6.x86_64
qt-mysql-4.8.7-2.el7.x86_64
OB2-MYSQL-A.09.00-1.x86_64
MySQL-embedded-advanced-5.6.20-1.el6.x86_64
[shell]# rpm -e MySQL-shared-advanced-5.6.20-1.el6.x86_64
[shell]# rpm -e MySQL-test-advanced-5.6.20-1.el6.x86_64
[shell]# rpm -e MySQL-server-advanced-5.6.20-1.el6.x86_64
[shell]# rpm -e MySQL-devel-advanced-5.6.20-1.el6.x86_64
[shell]# rpm -e MySQL-client-advanced-5.6.20-1.el6.x86_64
[shell]# rpm -e MySQL-shared-compat-advanced-5.6.20-1.el6.x86_64
STEP-4:Remove Configuration files and data
Optionally, you can remove configuration files and data.
If you created a configuration file under the / etc directory and it is no longer required, you can delete it.
shell> su -
shell# rm /etc/my.cnf
If the data is no longer needed, you can delete it. The location of the data depends on the configuration. Please refer to datadir, innodb_data_home_dir, innodb_data_file_path, innodb_log_group_home_dir. Generally, the default datadir /var/lib/mysql is used.
shell> su -
shell# rm -r /var/lib/mysql

Good
ReplyDeleteThanks
Delete