一、查看当前安装mysql情况,查找已安装的mysql
[root@localhost /]# rpm -qa | grep -i mysql
显示已安装:
MySQL-client-5.6.46-1.el7.x86_64
MySQL-server-5.6.46-1.el7.x86_64
二、卸载 执行: rpm -e -nodeps
下图:rpm -ev MySQL-server-5.6.46-1.el7.x86_64 长时间无结果,按ctrl + c 终止,更为手动删除
[root@localhost /]# rpm -ev MySQL-client-5.6.46-1.el7.x86_64
软件包准备中...
MySQL-client-5.6.46-1.el7.x86_64
[root@localhost /]# rpm -ev MySQL-server-5.6.46-1.el7.x86_64
软件包准备中...
^[[B^[[B^[[B^C错误:%preun(MySQL-server-5.6.46-1.el7.x86_64) 脚本执行失败,捕捉到信号: 2
错误:MySQL-server-5.6.46-1.el7.x86_64: 删除 已失败
[root@localhost /]# ^C
三、手动删除文件 (查找并删除)
[root@localhost /]# find / -name mysql
/run/lock/subsys/mysql
/etc/rc.d/init.d/mysql
/etc/logrotate.d/mysql
/var/lib/mysql
/usr/lib64/mysql
/usr/share/mysql
[root@localhost /]# rm -rf /run/lock/subsys/mysql
[root@localhost /]# find / -name mysql
/etc/rc.d/init.d/mysql
/etc/logrotate.d/mysql
/var/lib/mysql
/usr/lib64/mysql
/usr/share/mysql
[root@localhost /]# rm -rf /etc/rc.d/init.d/mysql
[root@localhost /]# rm -rf /etc/logrotate.d/mysql
[root@localhost /]# rm -rf /var/lib/mysql
[root@localhost /]# rm -rf /usr/lib64/mysql
[root@localhost /]# rm -rf /usr/share/mysql
连同my.cnf文件一并删除
[root@localhost /]# whereis my.cnf
my: /etc/my.cnf
[root@localhost /]# rm -rf /etc/my.cnf
删除后,再次执行查找命令,检查是否已删除
[root@localhost /]# find / -name mysql
再次执行:rpm -qa| grep -i mysql,检查卸载
[root@localhost /]# rpm -qa| grep -i mysql
MySQL-server-5.6.46-1.el7.x86_64
(程序依然存在,其实是假象)再执行卸载命令:
[root@localhost /]# rpm -ev MySQL-server-5.6.46-1.el7.x86_64 --nodeps
软件包准备中...
MySQL-server-5.6.46-1.el7.x86_64
警告:文件 /var/lib/mysql: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/ukrainian/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/swedish/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/spanish/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/slovak/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/serbian/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/russian/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/romanian/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/portuguese/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/polish/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/norwegian/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/norwegian-ny/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/mysqld_multi.server: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/mysql_test_data_timezone.sql: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/mysql_system_tables_data.sql: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/mysql_system_tables.sql: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/mysql_security_commands.sql: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/mysql.server: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/mysql-log-rotate: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/my-default.cnf: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/magic: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/korean/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/japanese/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/italian/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/innodb_memcached_config.sql: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/hungarian/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/greek/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/german/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/french/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/fill_help_tables.sql: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/estonian/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/errmsg-utf8.txt: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/english/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/dutch/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/dictionary.txt: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/danish/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/czech/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/swe7.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/macroman.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/macce.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/latin7.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/latin5.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/latin2.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/latin1.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/koi8u.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/koi8r.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/keybcs2.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/hp8.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/hebrew.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/greek.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/geostd8.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/dec8.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/cp866.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/cp852.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/cp850.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/cp1257.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/cp1256.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/cp1251.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/cp1250.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/ascii.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/armscii8.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/README: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/charsets/Index.xml: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/bulgarian/errmsg.sys: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/bulgarian: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/binary-configure: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/SELinux/RHEL4/mysql.te: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/SELinux/RHEL4/mysql.fc: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/SELinux/RHEL4: 移除失败: 没有那个文件或目录
警告:文件 /usr/share/mysql/SELinux: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/validate_password.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/udf_example.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/test_udf_services.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/semisync_slave.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/semisync_master.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/qa_auth_server.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/qa_auth_interface.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/qa_auth_client.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/mysql_no_login.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/mypluglib.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/libmemcached.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/libdaemon_example.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/innodb_engine.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/ha_example.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/validate_password.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/udf_example.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/test_udf_services.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/semisync_slave.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/semisync_master.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/qa_auth_server.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/qa_auth_interface.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/qa_auth_client.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/mysql_no_login.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/mypluglib.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/libmemcached.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/libdaemon_example.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/innodb_engine.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/ha_example.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/connection_control.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/auth_test_plugin.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/auth_socket.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/auth.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/debug/adt_null.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/daemon_example.ini: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/connection_control.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/auth_test_plugin.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/auth_socket.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/auth.so: 移除失败: 没有那个文件或目录
警告:文件 /usr/lib64/mysql/plugin/adt_null.so: 移除失败: 没有那个文件或目录
警告:文件 /etc/init.d/mysql: 移除失败: 没有那个文件或目录
(文件已经删除)重启后:执行rpm -qa | grep -i mysql
[root@localhost ~]# rpm -qa | grep -i mysql
[root@localhost ~]# rpm -qa | grep mysql
[root@localhost ~]#
无结果,说明卸载完成。
小结:
Linux 与 windows 卸载大步骤一致:
1、执行卸载程序
2、若程序卸载失败或无法卸载,找到安装路径,删除安装文件
3、清理文件、注册表等残余文件