62

到目前为止,我已经尝试了以下命令:

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

但是每当我尝试使用以下命令定位 MySQL 时,我都会得到一个与 MySQL 相关的文件列表:

shell>> locate mysql

输出:

/etc/mysql
/etc/apparmor.d/usr.sbin.mysqld
/etc/apparmor.d/abstractions/mysql
/etc/apparmor.d/cache/usr.sbin.mysqld
/etc/apparmor.d/cache/usr.sbin.mysqld-akonadi
/etc/apparmor.d/local/usr.sbin.mysqld
/etc/bash_completion.d/mysqladmin
/etc/init/mysql.conf
/etc/logcheck/ignore.d.paranoid/mysql-server-5_5
/etc/logcheck/ignore.d.server/mysql-server-5_5
/etc/logcheck/ignore.d.workstation/mysql-server-5_5
/etc/logrotate.d/mysql-server
/etc/mysql/conf.d
/etc/mysql/debian-start
/etc/mysql/debian.cnf
/etc/mysql/conf.d/mysqld_safe_syslog.cnf
/home/pkr/.mysql_history
/home/pkr/.cache/software-center/piston-helper/rec.ubuntu.com,api,1.0,recommend_app,libqt4-sql-mysql,,349051c3a57da571aa832adb39177aff
/home/pkr/.cache/software-center/piston-helper/rec.ubuntu.com,api,1.0,recommend_app,mysql-client,,cbf77a486cdc80547317981a33144427
/home/pkr/.cache/software-center/piston-helper/rec.ubuntu.com,api,1.0,recommend_app,mysql-client,,de8220dee4d957a9502caa79e8d2fdda
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,any,any,any,libqt4-sql-mysql,page,1,helpful,,17fb2e657321dc51526ee8fe9928da30
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,any,any,any,mysql-client,page,1,helpful,,a4c1b6e8200f36ab5745c6f81f14da0a
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,ubuntu,oneiric,any,libqt4-sql-mysql,page,1,helpful,,c54295fb82b8183350cd34f22c3547ef
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,ubuntu,oneiric,any,mysql-client,page,1,helpful,,fcf201c1abff3f774af89173a84de2cc
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,ubuntu,precise,any,libqt4-sql-mysql,page,1,helpful,,0cd86648584efeccfb16119012f89540
/home/pkr/.cache/software-center/rnrclient/reviews.ubuntu.com,reviews,api,1.0,reviews,filter,en,ubuntu,precise,any,mysql-client,page,1,helpful,,eb84724e9da7851ff8862a227d8bac59
/home/pkr/.local/share/akonadi/mysql.conf
/home/pkr/.local/share/akonadi/db_data/mysql
/home/pkr/.local/share/akonadi/db_data/mysql.err
/home/pkr/.local/share/akonadi/db_data/mysql.err.old
/home/pkr/.local/share/akonadi/db_data/mysql/columns_priv.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/columns_priv.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/columns_priv.frm
/home/pkr/.local/share/akonadi/db_data/mysql/db.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/db.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/db.frm
/home/pkr/.local/share/akonadi/db_data/mysql/event.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/event.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/event.frm
/home/pkr/.local/share/akonadi/db_data/mysql/func.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/func.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/func.frm
/home/pkr/.local/share/akonadi/db_data/mysql/general_log.CSM
/home/pkr/.local/share/akonadi/db_data/mysql/general_log.CSV
/home/pkr/.local/share/akonadi/db_data/mysql/general_log.frm
/home/pkr/.local/share/akonadi/db_data/mysql/help_category.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/help_category.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/help_category.frm
/home/pkr/.local/share/akonadi/db_data/mysql/help_keyword.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/help_keyword.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/help_keyword.frm
/home/pkr/.local/share/akonadi/db_data/mysql/help_relation.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/help_relation.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/help_relation.frm
/home/pkr/.local/share/akonadi/db_data/mysql/help_topic.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/help_topic.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/help_topic.frm
/home/pkr/.local/share/akonadi/db_data/mysql/host.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/host.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/host.frm
/home/pkr/.local/share/akonadi/db_data/mysql/ndb_binlog_index.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/ndb_binlog_index.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/ndb_binlog_index.frm
/home/pkr/.local/share/akonadi/db_data/mysql/plugin.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/plugin.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/plugin.frm
/home/pkr/.local/share/akonadi/db_data/mysql/proc.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/proc.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/proc.frm
/home/pkr/.local/share/akonadi/db_data/mysql/procs_priv.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/procs_priv.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/procs_priv.frm
/home/pkr/.local/share/akonadi/db_data/mysql/proxies_priv.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/proxies_priv.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/proxies_priv.frm
/home/pkr/.local/share/akonadi/db_data/mysql/servers.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/servers.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/servers.frm
/home/pkr/.local/share/akonadi/db_data/mysql/slow_log.CSM
/home/pkr/.local/share/akonadi/db_data/mysql/slow_log.CSV
/home/pkr/.local/share/akonadi/db_data/mysql/slow_log.frm
/home/pkr/.local/share/akonadi/db_data/mysql/tables_priv.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/tables_priv.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/tables_priv.frm
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone.frm
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_leap_second.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_leap_second.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_leap_second.frm
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_name.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_name.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_name.frm
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition.frm
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition_type.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition_type.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/time_zone_transition_type.frm
/home/pkr/.local/share/akonadi/db_data/mysql/user.MYD
/home/pkr/.local/share/akonadi/db_data/mysql/user.MYI
/home/pkr/.local/share/akonadi/db_data/mysql/user.frm
/usr/bin/mysql
/usr/bin/mysql_install_db
/usr/bin/mysql_upgrade
/usr/bin/mysqlcheck
/usr/sbin/mysqld
/usr/share/mysql
/usr/share/app-install/desktop/gmysqlcc:gmysqlcc.desktop
/usr/share/app-install/desktop/mysql-client.desktop
/usr/share/app-install/desktop/mysql-navigator:mysql-navigator.desktop
/usr/share/app-install/desktop/mysql-server.desktop
/usr/share/app-install/icons/gmysqlcc-32.png
/usr/share/app-install/icons/mysql-navigator.png
/usr/share/doc/mysql-client-core-5.5
/usr/share/doc/mysql-server-core-5.5
/usr/share/kde4/apps/katepart/syntax/sql-mysql.xml
/usr/share/man/man1/mysql.1.gz
/usr/share/man/man1/mysql_install_db.1.gz
/usr/share/man/man1/mysql_upgrade.1.gz
/usr/share/man/man1/mysqlcheck.1.gz
/usr/share/man/man8/mysqld.8.gz
/var/cache/apt/archives/akonadi-backend-mysql_1.7.2-0ubuntu1_all.deb
/var/cache/apt/archives/libmysqlclient-dev_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/libmysqlclient18_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/libqt4-sql-mysql_4%3a4.8.1-0ubuntu4.1_i386.deb
/var/cache/apt/archives/mysql-client-5.5_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/mysql-client-core-5.5_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/mysql-client_5.5.22-0ubuntu1_all.deb
/var/cache/apt/archives/mysql-common_5.5.22-0ubuntu1_all.deb
/var/cache/apt/archives/mysql-server-5.5_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/mysql-server-core-5.5_5.5.22-0ubuntu1_i386.deb
/var/cache/apt/archives/mysql-server_5.5.22-0ubuntu1_all.deb
/var/lib/dpkg/info/mysql-client-core-5.5.list
/var/lib/dpkg/info/mysql-client-core-5.5.md5sums
/var/lib/dpkg/info/mysql-server-5.5.list
/var/lib/dpkg/info/mysql-server-5.5.postrm
/var/lib/dpkg/info/mysql-server-core-5.5.list
/var/lib/dpkg/info/mysql-server-core-5.5.md5sums
/var/log/mysql
/var/log/mysql.err
/var/log/mysql.log
/var/log/mysql.log.1.gz
/var/log/mysql.log.2.gz
/var/log/mysql.log.3.gz
/var/log/mysql.log.4.gz
/var/log/mysql.log.5.gz
/var/log/mysql.log.6.gz
/var/log/mysql.log.7.gz
/var/log/upstart/mysql.log.1.gz
/var/log/upstart/mysql.log.2.gz
/var/log/upstart/mysql.log.3.gz
/var/log/upstart/mysql.log.4.gz
/var/log/upstart/mysql.log.5.gz
/var/log/upstart/mysql.log.6.gz
/var/log/upstart/mysql.log.7.gz

我现在该怎么办?

我试图找出是否有任何方法可以删除所有 MySQL 相关文件,然后重新安装 MySQL。

我需要它来进行 Qt 连接。

4

3 回答 3

156

使用命令:

sudo apt-get remove --purge mysql\*

您可以删除与名为 mysql 的包相关的任何内容。这些命令仅在基于 debian / debian 的 linux 发行版(例如 Ubuntu)上有效。

您可以使用以下命令列出所有已安装的 mysql 包:

sudo dpkg -l | grep -i mysql

要更多地清理包缓存,您可以使用以下命令:

sudo apt-get clean

另外,请记住使用以下命令:

sudo updatedb

否则“定位​​”命令将显示旧数据。

要再次安装 mysql,请使用以下命令:

sudo apt-get install libmysqlclient-dev mysql-client

这将安装 mysql 客户端、libmysql 及其头文件。

要安装 mysql 服务器,请使用以下命令:

sudo apt-get install mysql-server
于 2012-06-02T10:08:56.337 回答
17

只是对@dAm2k 答案的一点补充:

此外sudo apt-get remove --purge mysql\*

我做了一个sudo apt-get remove --purge mariadb\*.

我似乎在 debian (stretch) 的新版本中,当你安装 mysql 时,它会安装 mariadb 包。

希望能帮助到你。

于 2017-08-07T11:42:00.797 回答
0

即使在我运行时执行了mysql删除命令和删除Mariadb的命令


    sudo dpkg -l | grep -i mysql

我仍然得到以下输出,它显示了来自 mysql 服务器的文件

pi@Home:/ $ sudo dpkg -l | grep -i mysql
ii  mysql-common                          5.8+1.0.5                              all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  php-mysql                             2:7.3+69                               all          MySQL module for PHP [default]
ii  php7.3-mysql                          7.3.27-1~deb10u1                       armhf        MySQL module for PHP
ii  phpmyadmin                            4:4.6.6-5                              all          MySQL web administration tool

但是当我运行以下命令时,我没有得到 mysql 的迹象


> pi@Home:/ $ sudo mysql sudo: mysql: command not found pi@Home:/ $ sudo
> service mysql restart Failed to restart mysql.service: Unit
> mysql.service not found.

这是什么意思?如果 mysql 被删除,为什么我仍在查看这些文件,如果我重新安装 mysql,它不会干扰全新安装

于 2021-03-02T01:18:15.310 回答