一, 登陆阿里云服务器后,查看mysql状态,看到LISTEN表示已安装mysql成功
1.
root@iZ2ze47s90mcta2n9nz9mgZ:/# sudo netstat -tap | grep mysql
tcp 0 0 localhost:mysql *:* LISTEN 3051/mysqld
二,卸载
2.
sudo apt-get remove mysql-server
root@iZ2ze47s90mcta2n9nz9mgZ:/# 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-client-5.7 mysql-client-core-5.7 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 61 not upgraded.
After this operation, 110 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 102732 files and directories currently installed.)
Removing mysql-server (5.7.24-0ubuntu0.16.04.1) ...
3,sudo apt-get autoremove mysql-server
root@iZ2ze47s90mcta2n9nz9mgZ:/# 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-client-5.7 mysql-client-core-5.7 mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 0 newly installed, 17 to remove and 61 not upgraded.
After this operation, 162 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 102728 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.24-0ubuntu0.16.04.1) ...
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-client-5.7 (5.7.24-0ubuntu0.16.04.1) ...
Removing mysql-client-core-5.7 (5.7.24-0ubuntu0.16.04.1) ...
Removing mysql-server-core-5.7 (5.7.24-0ubuntu0.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
4,sudo apt-get remove mysql-common
root@iZ2ze47s90mcta2n9nz9mgZ:/# 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:
zlib1g-dev
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
libmysqlclient-dev libmysqlclient20 mysql-common
0 upgraded, 0 newly installed, 3 to remove and 61 not upgraded.
After this operation, 11.5 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 102286 files and directories currently installed.)
Removing libmysqlclient-dev (5.7.24-0ubuntu0.16.04.1) ...
Removing libmysqlclient20:amd64 (5.7.24-0ubuntu0.16.04.1) ...
Removing mysql-common (5.7.24-0ubuntu0.16.04.1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
5,dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
root@iZ2ze47s90mcta2n9nz9mgZ:/# dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
(Reading database ... 102144 files and directories currently installed.)
Removing linux-image-4.4.0-87-generic (4.4.0-87.110) ...
Purging configuration files for linux-image-4.4.0-87-generic (4.4.0-87.110) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-87-generic /boot/vmlinuz-4.4.0-87-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-87-generic /boot/vmlinuz-4.4.0-87-generic
Removing linux-image-extra-4.4.0-87-generic (4.4.0-87.110) ...
Purging configuration files for linux-image-extra-4.4.0-87-generic (4.4.0-87.110) ...
Removing mysql-common (5.7.24-0ubuntu0.16.04.1) ...
Purging configuration files for mysql-common (5.7.24-0ubuntu0.16.04.1) ...
Removing mysql-server-5.7 (5.7.24-0ubuntu0.16.04.1) ...
Purging configuration files for mysql-server-5.7 (5.7.24-0ubuntu0.16.04.1) ...
6,sudo dpkg -i mysql-apt-config_0.7.2-1_all.deb
root@iZ2ze47s90mcta2n9nz9mgZ:/# 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
7,sudo apt-get update
root@iZ2ze47s90mcta2n9nz9mgZ:/# sudo apt-get update
Hit:1 http://mirrors.cloud.aliyuncs.com/ubuntu xenial InRelease
Get:2 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates InRelease [109 kB]
Get:3 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security InRelease [109 kB]
Get:4 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main Sources [335 kB]
Get:5 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/universe Sources [254 kB]
Get:6 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main amd64 Packages [957 kB]
Get:7 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main i386 Packages [824 kB]
Get:8 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/main Translation-en [381 kB]
Get:9 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/universe amd64 Packages [748 kB]
Get:10 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/universe i386 Packages [685 kB]
Get:11 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-updates/universe Translation-en [311 kB]
Get:12 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/main Sources [146 kB]
Get:13 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/universe Sources [105 kB]
Get:14 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/main amd64 Packages [647 kB]
Get:15 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/main i386 Packages [535 kB]
Get:16 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/main Translation-en [264 kB]
Get:17 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/universe amd64 Packages [435 kB]
Get:18 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/universe i386 Packages [378 kB]
Get:19 http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security/universe Translation-en [176 kB]
Fetched 7,400 kB in 2s (3,579 kB/s)
Reading package lists... Done
8,查看mysql是否卸载完sudo netstat -tap | grep mysql
root@iZ2ze47s90mcta2n9nz9mgZ:/# sudo netstat -tap | grep mysql
root@iZ2ze47s90mcta2n9nz9mgZ:/#
我的这一步到此执行完后什么都不显示了,还有的显示如下
root@iZuf68o7f27da0srq88z1xZ:~# sudo netstat -tap | grep mysql
sudo: unable to resolve host iZuf68o7f27da0srq88z1xZ