如何在Ubuntu Linux上卸载MySQL Server

时间:2020-01-09 10:43:56  来源:igfitidea点击:

如何删除MySQL服务器,并将其从服务器中删除,因为我没有使用MySQL服务器。如何在基于Ubuntu的系统上卸载MySQL?通常在Debian或者Ubuntu Linux系统上安装以下Mysql软件包:

  • mysql-client最新版本的MySQL数据库客户端。
  • mysql-server最新版本的MySQL数据库服务器。
  • mysql-common MySQL数据库通用文件。

如何卸载Mysql服务器?

只需使用apt-get命令,如下所示,在Ubuntu Linux中删除MySQL服务器和客户端:

sudo apt-get --purge remove mysql-client mysql-server mysql-common
sudo apt-get autoremove

示例输出(注意包名称):

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.2.0-31-virtual linux-headers-3.2.0-31
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  libdbd-mysql-perl* libmysqlclient18* mysql-client* mysql-client-5.5* mysql-common* mysql-server*
  mysql-server-5.5*
0 upgraded, 0 newly installed, 7 to remove and 0 not upgraded.
After this operation, 67.5 MB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 105097 files and directories currently installed.)
Removing mysql-server ...
Removing mysql-server-5.5 ...
mysql stop/waiting
Purging configuration files for mysql-server-5.5 ...
Removing mysql-client ...
Removing mysql-client-5.5 ...
Removing libdbd-mysql-perl ...
Removing libmysqlclient18 ...
Purging configuration files for libmysqlclient18 ...
Removing mysql-common ...
Purging configuration files for mysql-common ...
dpkg: warning: while removing mysql-common, directory '/etc/mysql' not empty so not removed.
Processing triggers for ureadahead ...
Processing triggers for man-db ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

使用rm命令删除/etc/mysql /目录:

$ sudo rm -rf /etc/mysql/

了解apt-get命令选项

  • --purge:删除给定的软件包和配置文件。
  • remove:卸载软件包。
  • autoremove:强制删除自动安装的软件包,以满足其他软件包的依赖性,现在不再需要。