>  기사  >  데이터 베이스  >  Linux 下卸载MySQL 5_MySQL

Linux 下卸载MySQL 5_MySQL

WBOY
WBOY원래의
2016-06-01 13:16:111079검색

mysql卸载

    对于在Linux下通过rpm方式的mysql,我们可以通过移除这些rpm包以及删除项目的目录来达到卸载的目的。本文演示了在SUSE Linux 10下下载MySQL 5.5.37。具体见下文。

1、环境
#OS环境
SZDB:~ #cat /etc/issue

Welcome to SUSE Linux Enterprise Server 10 SP3 (x86_64) - Kernel /r (/l).

#查看已安装的安装包
SZDB:~ #rpm -qa | grep -i mysql
MySQL-devel-5.5.37-1.sles10
MySQL-server-5.5.37-1.sles10
MySQL-shared-compat-5.5.37-1.sles10
MySQL-client-5.5.37-1.sles10
MySQL-shared-5.5.37-1.sles10
MySQL-test-5.5.37-1.sles10
MySQL-embedded-5.5.37-1.sles10

2、停止mysql服务
SZDB:~ #/etc/init.d/mysql stop 
Shutting down MySQL.              done

3、使用rpm卸载mysql
SZDB:~ #rpm -e --nodeps MySQL-server-5.5.37-1.sles10
insserv: script postgresqlMemory: service postgresql already provided!
insserv: script postgresql: service postgresql already provided!
mysql                     0:off  1:off  2:off  3:off  4:off  5:off  6:off

#使用下面的方式移除所有mysql rpm包
SZDB:~ # rpm -e --nodeps MySQL-client-5.5.37-1.sles10
SZDB:~ # rpm -e --nodeps MySQL-devel-5.5.37-1.sles10
SZDB:~ # rpm -e --nodeps MySQL-shared-compat-5.5.37-1.sles10
SZDB:~ # rpm -e --nodeps MySQL-shared-5.5.37-1.sles10
SZDB:~ # rpm -e --nodeps MySQL-test-5.5.37-1.sles10
SZDB:~ # rpm -e --nodeps MySQL-embedded-5.5.37-1.sles10

4、移除相关mysql目录及文件
SZDB:~ #find / -name mysql
/etc/apparmor.d/abstractions/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/usr/lib64/mysql
/usr/local/quickfix_old/src/sql/mysql
SZDB:~ # rm -rf /etc/apparmor.d/abstractions/mysql
SZDB:~ # rm -rf /var/lib/mysql
SZDB:~ # rm -rf /var/lib/mysql/mysql
SZDB:~ # rm -rf /usr/lib64/mysql
SZDB:~ # rm -rf /usr/local/quickfix_old/src/sql/mysql

SZDB:~ # ls /etc/my*
/bin/ls: /etc/my*: No such file or directory
注,如果/etc目录下有my.cnf,也做相应移除
根据需要考虑是否移除linux下的mysql 用户
SZDB:~ # cat /etc/passwd | grep mysql
mysql:x:104:106:MySQL server:/var/lib/mysql:/bin/bash

5、校验结果
SZDB:~ #rpm -qa | grep -i mysql
SZDB:~ #chkconfig --list |grep mysql

有关Linux下安装MySQL可参考:
     Linux 5 下安装MySQL 5.6(RPM方式)

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.