linux 下完全解除安裝mysql

2021-10-04 17:27:19 字數 4068 閱讀 1340

rpm包安裝方式的mysql解除安裝

1關閉mysql服務

[root@server bin]

# service mysql stop

shutting down mysql.

. success!

[root@server bin]

# service mysql status

error! mysql is not running

2刪除mysql對應的資料夾
查詢檔案

[root@server bin]

# find / -name mysql

/home/mysql

/etc/rc.d/init.d/mysql

/etc/selinux/targeted/active/modules/100/mysql

/var

/lib/mysql

/var

/lib/mysql/mysql

/usr/bin/mysql

/usr/lib64/mysql

/usr/share/mysql

/usr/local/mysql

/usr/local/mysql/bin/mysql

/usr/local/mysql/include/mysql

/usr/local/mysql/

data

/mysql

刪除檔案

[root@server bin]

# rm -rf /var/lib/mysql

[root@server bin]

# rm -rf /var/lib/mysql^c

[root@server bin]

# rm -rf /var/lib/mysql/mysql

[root@server bin]

# rm -rf /usr/bin/mysql

[root@server bin]

# rm -rf /usr/lib64/mysql

[root@server bin]

# rm -rf /usr/share/mysql

[root@server bin]

# rm -rf /usr/local/mysql

[root@server bin]

# rm -rf /usr/local/mysql/bin/mysql

[root@server bin]

# rm -rf /usr/local/mysql/include/mysql

[root@server bin]

# rm -rf /usr/local/mysql/data/mysql

3: 檢查是否安裝了mysql元件。
[root@server /]

# rpm -qa | grep -i mysql

有就刪除

刪除命令如下

rpm -ev mysql-devel-5.6.23-1.linux_glibc2.5

4刪除mysql使用者及使用者組
[root@server bin]

# more /etc/passwd | grep mysql

mysql:x:998:1000::/home/mysql:/bin/bash

[root@server bin]

# more /etc/shadow | grep mysql

mysql:!

!:17438::::::

[root@server bin]

# more /etc/group | grep mysql

mysql:x:1000:

[root@server bin]

# userdel mysql

[root@server bin]

# groupdel mysql

groupdel: group

'mysql' does not exist

檢視[root@server bin]

# more /etc/passwd | grep mysql

[root@server bin]

# more /etc/group | grep mysql

[root@server bin]

# more /etc/shadow | grep mysql

二進位製包/原始碼安裝方式的mysql解除安裝

1: 檢查mysql服務並關閉服務程序。

首先通過程序檢視是否有mysql的服務的狀態, 如下所示,mysql服務是啟動的。

[root@server bin]

# ps -ef | grep mysql

關閉mysql服務

[root@server bin]

# service mysql stop

shutting down mysql.

. success!

[root@server bin]

# service mysql status

error! mysql is not running

2: 查詢mysql的安裝目錄並徹底刪除

查詢檔案

[root@server bin]

# find / -name mysql

/home/mysql

/etc/rc.d/init.d/mysql

/etc/selinux/targeted/active/modules/100/mysql

/var

/lib/mysql

/var

/lib/mysql/mysql

/usr/bin/mysql

/usr/lib64/mysql

/usr/share/mysql

/usr/local/mysql

/usr/local/mysql/bin/mysql

/usr/local/mysql/include/mysql

/usr/local/mysql/

data

/mysql

刪除檔案

[root@server bin]

# rm -rf /var/lib/mysql

[root@server bin]

# rm -rf /var/lib/mysql^c

[root@server bin]

# rm -rf /var/lib/mysql/mysql

[root@server bin]

# rm -rf /usr/bin/mysql

[root@server bin]

# rm -rf /usr/lib64/mysql

[root@server bin]

# rm -rf /usr/share/mysql

[root@server bin]

# rm -rf /usr/local/mysql

[root@server bin]

# rm -rf /usr/local/mysql/bin/mysql

[root@server bin]

# rm -rf /usr/local/mysql/include/mysql

[root@server bin]

# rm -rf /usr/local/mysql/data/mysql

3刪除一些配置檔案

配置檔案一般有/etc/my.cnf 或/etc/init.d/mysql.server

[root@server bin]

# rm -f /etc/my.cnf

[root@server bin]

# rm -rf /etc/init.d/mysql.server

4:刪除mysql使用者以及使用者組

[root@server bin]

# userdel mysql

[root@server bin]

# id mysql

id: mysql: no such user

Linux下完全解除安裝mysql

1.檢視是否安裝mysql rpm qa grep i mysql 2.關閉mysql服務 service mysql status 檢視執行狀態 service mysql stop 停止執行 service mysql status 檢視執行狀態是否停止 3.解除安裝mysql的相關元件,ev後...

centos下完全解除安裝mysql

yum方式安裝的mysql 1 yum remove mysql mysql server mysql libs compat mysql51 2 rm rf var lib mysql 3 rm etc my.cnf 檢視是否還有mysql軟體 rpm qa grep mysql 如果存在的話,繼...

centos下完全解除安裝mysql

yum方式安裝的mysql 1 yum remove mysql mysql server mysql libs compat mysql51 2 rm rf var lib mysql 3 rm etc my.cnf 檢視是否還有mysql軟體 rpm qa grep mysql 如果存在的話,繼...