红联Linux门户
Linux帮助

阿里云Ubuntu系统下mysql卸载

发布时间:2017-04-09 09:42:30来源:linux网站作者:fuzongjian
一、ssh登录阿里云服务器,查看MySQL的安装状态。
root@iZwz96t1p8ke0a4l01771vZ:~# sudo netstat -tap | grep mysql
tcp        0      0 localhost:mysql         *:*                     LISTEN      24688/mysqld
以上表示,当前系统已经安装了mysql。
 
二、因为种种原因,我需要卸载mysql。
1、第一步: sudo apt-get remove mysql-server.
root@iZwz96t1p8ke0a4l01771vZ:~# sudo apt-get remove mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl
libhttp-message-perl libio-html-perl liblwp-mediatypes-perl liburi-perl mysql-server-5.7 mysql-server-core-5.7
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
mysql-server
0 upgraded, 0 newly installed, 1 to remove and 48 not upgraded.
After this operation, 175 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 100504 files and directories currently installed.)
Removing mysql-server (5.7.17-0ubuntu0.16.04.2) ...
2、第二步:sudo apt-get autoremove mysql-server.
root@iZwz96t1p8ke0a4l01771vZ:~# sudo apt-get autoremove mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'mysql-server' is not installed, so not removed
The following packages will be REMOVED:
libcgi-fast-perl libcgi-pm-perl libencode-locale-perl libevent-core-2.0-5 libfcgi-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl
libhttp-message-perl libio-html-perl liblwp-mediatypes-perl liburi-perl mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 0 newly installed, 15 to remove and 48 not upgraded.
After this operation, 96.3 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 100500 files and directories currently installed.)
Removing libcgi-fast-perl (1:2.10-1) ...
Removing libhtml-template-perl (2.95-2) ...
Removing libcgi-pm-perl (4.26-1) ...
Removing libhttp-message-perl (6.11-1) ...
Removing libencode-locale-perl (1.05-1) ...
Removing mysql-server-5.7 (5.7.17-0ubuntu0.16.04.2) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Removing libevent-core-2.0-5:amd64 (2.0.21-stable-2ubuntu0.16.04.1) ...
Removing libfcgi-perl (0.77-1build1) ...
Removing libhtml-parser-perl (3.72-1) ...
Removing libhtml-tagset-perl (3.20-2) ...
Removing libhttp-date-perl (6.02-1) ...
Removing libio-html-perl (1.001-1) ...
Removing liblwp-mediatypes-perl (6.02-1) ...
Removing liburi-perl (1.71-1) ...
Removing mysql-server-core-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu5) ...
3、第三步:sudo apt-get remove mysql-common.
root@iZwz96t1p8ke0a4l01771vZ:~# sudo apt-get remove mysql-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
mysql-client-core-5.7
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
mysql-client mysql-client-5.7 mysql-common
0 upgraded, 0 newly installed, 3 to remove and 48 not upgraded.
After this operation, 34.4 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 100103 files and directories currently installed.)
Removing mysql-client (5.7.17-0ubuntu0.16.04.2) ...
Removing mysql-client-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Removing mysql-common (5.7.17-0ubuntu0.16.04.2) ...
Processing triggers for man-db (2.7.5-1) ...
4、残留数据移除。
root@iZwz96t1p8ke0a4l01771vZ:~# dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P 
(Reading database ... 100056 files and directories currently installed.)
Removing mysql-common (5.7.17-0ubuntu0.16.04.2) ...
Purging configuration files for mysql-common (5.7.17-0ubuntu0.16.04.2) ...
Removing mysql-server-5.7 (5.7.17-0ubuntu0.16.04.2) ...
Purging configuration files for mysql-server-5.7 (5.7.17-0ubuntu0.16.04.2) ...
阿里云Ubuntu系统下mysql卸载
5、最后一步。
root@iZwz96t1p8ke0a4l01771vZ:~# sudo dpkg -i mysql-apt-config_0.7.2-1_all.deb
dpkg: error processing archive mysql-apt-config_0.7.2-1_all.deb (--install):
cannot access archive: No such file or directory
Errors were encountered while processing:
mysql-apt-config_0.7.2-1_all.deb
root@iZwz96t1p8ke0a4l01771vZ:~# sudo dpkg -i mysql-apt-config_0.7.2-1_all.deb
dpkg: error processing archive mysql-apt-config_0.7.2-1_all.deb (--install):
cannot access archive: No such file or directory
Errors were encountered while processing:
mysql-apt-config_0.7.2-1_all.deb
root@iZwz96t1p8ke0a4l01771vZ:~# sudo apt-get update
Hit:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease
Hit:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease
Hit:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease
Hit:4 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-proposed InRelease
Hit:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-backports InRelease
Reading package lists... Done 
 
三、卸载mysql完成。
root@iZwz96t1p8ke0a4l01771vZ:~# sudo netstat -tap | grep mysql
root@iZwz96t1p8ke0a4l01771vZ:~#
 
本文永久更新地址:http://www.linuxdiyf.com/linux/29856.html