Linux卸载MySQL 找出以前是否装有mysqlrpmm -qa|grep -i mysql显示器安装前:MySQL-server-5.6.22-1.el6.i686MySQL-client-5.6.22-1.el6.i686
二 停止mysql服务,删除之前安装的mysql删除命令:rpm -e –nodeps 包名
rpm -ev MySQL-server-5.6.22-1.el6.i686rpm -ev MySQL-client-5.6.22-1.el6.i686
如果提示依赖包错误,请使用以下命令尝试rpm -ev MySQL-client-5.6.22-1.el6.i686 --nodeps
若提示错误:error: %preun(xxxxxx) scriptlet failed, exit status 一是用以下命令尝试:rpm -e --noscripts MySQL-client-5.6.22-1.el6.i686
三 查找旧版本的mysql目录,删除旧版本的mysql文件和库find / -name mysql
搜索结果如下:find / -name mysql
/var/lib/mysql/var/lib/mysql/mysql/run/lock/subsys/mysql/etc/selinux/targeted/active/modules/100/mysql/usr/lib64/mysql/usr/share/mysql/usr/lib/mysql/usr/local/mysql
删除相应的mysql目录rm -rf /usr/lib/mysqlrm -rf /usr/local/mysqlrm -rf /usr/lib64/mysqlrm -rf /run/lock/subsys/mysqlrm -rf /etc/selinux/targeted/active/modules/100/mysql…
四 卸载后/etc/my.cnf不会被删除,rm需要手动删除 -rf /etc/my.cnf
五 再次检查机器是否安装mysqlrpmm -qa|grep -i mysql