linux笔记 - 彻底卸载mysql

Linux下彻底卸载mysql

1、查看当前安装mysql情况,查找以前是否装有mysql

rpm -qa|grep -i mysql

2、停止mysql服务、删除之前安装的mysql

rpm -ev MySQL-client-5.5.25a-1.rhel5 
rpm -ev MySQL-server-5.5.25a-1.rhel5

如果提示依赖包错误,则使用以下命令尝试

rpm -ev MySQL-client-5.5.25a-1.rhel5 --nodeps

如果提示错误:error: %preun(xxxxxx) scriptlet failed, exit status 1

则用以下命令尝试:

rpm -e --noscripts MySQL-client-5.5.25a-1.rhel5

3、查找之前老版本mysql的目录、并且删除老版本mysql的文件和库

find / -name mysql 
 
/var/lib/mysql
/var/lib/mysql/mysql
/usr/lib64/mysql

 删除对应的mysql目录

rm -rf /var/lib/mysql
rm -rf /var/lib/mysql
rm -rf /usr/lib64/mysql

注意:卸载后/etc/my.cnf不会删除,需要进行手工删除

rm -rf /etc/my.cnf

4、再次查找机器是否安装mysql

rpm -qa|grep -i mysql

安装MySQL

参考:https://www.cnblogs.com/lzhdonald/p/12511998.html

安装MySQL出现Job for mysqld.service failed because the control process exited with error code问题

https://blog.csdn.net/aiyowei1106/article/details/88703746

 

 

 

 

你可能感兴趣的:(MySql)