Uninstalling MySQLYou can generally install a newer software package over an older
one by using the rpm -upgrade, urpmi
, yum update, or apt-get install commands described earlier. If,
you actually want to remove a package altogether rather than upgrading it, you should first type
su - to login as the root user, and then execute the appropriate uninstall commands.
Note that the data directory that contains your database files is not actually installed but created after installation. This is typically the directory
data under the MySQL base directory, or
/var/lib/mysql fora Linux distribution package installation.
UninstallingMySQL packages does not delete this directory, so the files containing your data should remain in place, unchanged.
For an RPM-based
system such as Red Hat, Fedora, or Mandriva, use the rpm -erase command to uninstall specific packages. If you’re unsure what the exact package names are, you can use the rpm -query -all command
to list all the installedRPM packages, together with the grep --ignore-case command to show only those with “mysql” (in uppercase or lowercase letters) in their name
rpm -query -all | grep --ignore-case mysqlperl-DBD-mysql-3.0004-1mdv2007.0
MySQL-5.0.23-1mdv2007.0
libmysql15-5.0.23-1mdv2007.0
MySQL-client-5.0.23-1mdv2007.0
php-mysql-5.1.4-3mdv2007.0
MySQL-common-5.0.23-1mdv2007.0
Note that the
.rpm file extension is not considered to be part of the package name. To uninstall RPM packages, you use the rpm
command with the erase option, and list the packages to remove. For example, you’d type (all on one line
rpm -erase \perl-DBD-mysql-3.0004-1mdv2007.0 \ MySQL-5.0.23-1mdv2007.0 \ libmysql15-5.0.23-1mdv2007.0 \ MySQL-client-5.0.23-1mdv2007.0 \ php-mysql-5.1.4-3mdv2007.0 \Share with your friends: