本文摘自PHP中文网,作者小云云,侵删。
本文主要介绍了Linux下卸载MySQL数据库的方法,不知道Linux下卸载MySQL数据库的小伙伴们可以学习一下,本文具有一定的参考价值,希望能帮助到大家。如何在Linux下卸载MySQL数据库呢? 下面总结、整理了一下Linux平台下卸载MySQL的方法。 MySQL的安装主要有三种方式:二进制包安装(Using Generic Binaries)、RPM包安装、源码安装。对应不同的安装方式,卸载的步骤有些不同。文章中如有不足或不对的地方,敬请指出或补充!
RPM包安装方式的MySQL卸载
1、检查是否安装了MySQL组件。
1 2 3 4 | [root@DB-Server init.d]
MySQL-devel-5.6.23-1.linux_glibc2.5
MySQL-client-5.6.23-1.linux_glibc2.5
MySQL-server-5.6.23-1.linux_glibc2.5
|

如上所示,说明安装了MySQL 5.6.23这个版本的client、server、devel三个组件。
2、卸载前关闭MySQL服务
2.1 方法1
1 2 3 4 5 6 | [root@DB-Server init.d]
MySQL running (25673)[ OK ]
[root@DB-Server init.d]
Shutting down MySQL..[ OK ]
[root@DB-Server init.d]
MySQL is not running[FAILED]
|

2.2 方法2
1 2 3 4 5 6 7 | [root@DB-Server init.d]
MySQL running (26215)[ OK ]
[root@DB-Server init.d]
Shutting down MySQL..[ OK ]
[root@DB-Server init.d]
MySQL is not running[FAILED]
[root@DB-Server init.d]
|

1 2 3 | [root@DB-Server init.d]
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@DB-Server init.d]
|
3. 收集MySQL对应的文件夹信息
[root@DB-Server init.d]# whereis mysql
mysql: /usr/bin/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
最好实用find命令查看MySQL数据库相关的文件,方便后面彻底删除MySQL。
1 2 3 4 5 6 7 8 9 10 11 | [root@DB-Server init.d]
/etc/rc .d /init .d /mysql
/etc/logrotate .d /mysql
/var/lock/subsys/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/include/mysql
/usr/include/mysql/mysql
/usr/bin/mysql
/usr/share/mysql
/usr/lib64/mysql
|

4、卸载删除MySQL各类组件
1 2 3 4 5 6 | [root@DB-Server init.d]
[root@DB-Server init.d]
[root@DB-Server init.d]
You have new mail in /var/spool/mail/root
[root@DB-Server init.d]
[root@DB-Server init.d]
|

5、删除MySQL对应的文件夹
检查各个MySQL文件夹是否清理删除干净。
1 2 3 4 5 6 7 8 9 10 | [root@DB-Server init.d]
mysql:
[root@DB-Server init.d]
/var/lib/mysql
/var/lib/mysql/mysql
/usr/lib64/mysql
[root@DB-Server init.d]
[root@DB-Server init.d]
[root@DB-Server init.d]
[root@DB-Server init.d]
|
6、删除mysql用户及用户组
如果有必要,删除mysql用户以及mysql用户组。
阅读剩余部分
相关阅读 >>
怎样手动打开mysql服务
mysql 中 innodb 和 myisam 区别
如何查看mysql的用户名和密码
mysql文档存放在哪
mysql的增删改查sql语句总结
mysql有几种隔离级别
mysql压缩包版怎么安装?
Linux下怎么打开mysql数据库
mysql数据如何生成php数组文件
mysql如何设置默认编码为utf-8
更多相关阅读请进入《Linux》频道 >>
机械工业出版社
本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。
转载请注明出处:木庄网络博客 » Linux下卸载MySQL数据库实例教程