从 CentOS 7 或 RHEL 7 中完全删除 MariaDB 或 MySQL

2022-01-13 00:00:00 yum mariadb centos mysql rhel

我在 CentOS 7 上安装了 MariaDB,但我在某些配置方面遇到了一些问题,现在它完全配置错误.

I installed MariaDB on CentOS 7 but I had some problems with some configuration, now it is completely misconfigured.

因此,我想用yum remove mariadb mariadb-server"删除MariaDB,然后用yum install mariadb mariadb-server"重新安装.

Thus, I wanted to remove the MariaDB with "yum remove mariadb mariadb-server", after that I reinstalled it with "yum install mariadb mariadb-server".

不幸的是,配置仍然存在.好像 yum remove 并没有删除所有 MariaDB 配置文件.

Unfortunately, the configuration remains. It seems as if yum remove don’t delete all MariaDB Config-Files.

如何从 CentOS 7 中彻底删除 MariaDB?

How can I remove MariaDB completely from CentOS 7?

推荐答案

这些步骤适用于 CentOS 6.5,因此它们也应该适用于 CentOS 7:

These steps are working on CentOS 6.5 so they should work on CentOS 7 too:

(编辑 - 完全相同的步骤适用于 CentOS 8 上的 MariaDB 10.3)

(EDIT - exactly the same steps work for MariaDB 10.3 on CentOS 8)

  1. yum 删除 mariadb mariadb-server
  2. rm -rf/var/lib/mysql 如果 /etc/my.cnf 中的 datadir 指向不同的目录,请删除该目录而不是 /var/lib/mysql
  3. rm/etc/my.cnf该文件可能已在步骤 1 中删除
  4. 可选步骤:rm ~/.my.cnf
  5. yum install mariadb mariadb-server
  1. yum remove mariadb mariadb-server
  2. rm -rf /var/lib/mysql If your datadir in /etc/my.cnf points to a different directory, remove that directory instead of /var/lib/mysql
  3. rm /etc/my.cnf the file might have already been deleted at step 1
  4. Optional step: rm ~/.my.cnf
  5. yum install mariadb mariadb-server

[EDIT] - CentOS 7 上 MariaDB 10.1 的更新

[EDIT] - Update for MariaDB 10.1 on CentOS 7

上述步骤适用于 CentOS 6.5 和 MariaDB 10.

The steps above worked for CentOS 6.5 and MariaDB 10.

我刚刚在 CentOS 7 上安装了 MariaDB 10.1,其中一些步骤略有不同.

I've just installed MariaDB 10.1 on CentOS 7 and some of the steps are slightly different.

第 1 步将变为:

yum remove MariaDB-server MariaDB-client

第 5 步将变为:

yum install MariaDB-server MariaDB-client

其他步骤保持不变.

相关文章