Completely remove MariaDB or MySQL from CentOS 7 or RHEL 7

后端 未结 3 446
逝去的感伤
逝去的感伤 2021-01-30 09:00

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

Thus, I wanted to remove the MariaDB with “yum remo

3条回答
  •  后悔当初
    2021-01-30 09:34

    To update and answer the question without breaking mail servers. Later versions of CentOS 7 have MariaDB included as the base along with PostFix which relies on MariaDB. Removing using yum will also remove postfix and perl-DBD-MySQL. To get around this and keep postfix in place, first make a copy of /usr/lib64/libmysqlclient.so.18 (which is what postfix depends on) and then use:

    rpm -qa | grep mariadb
    

    then remove the mariadb packages using (changing to your versions):

    rpm -e --nodeps "mariadb-libs-5.5.56-2.el7.x86_64"
    rpm -e --nodeps "mariadb-server-5.5.56-2.el7.x86_64"
    rpm -e --nodeps "mariadb-5.5.56-2.el7.x86_64"
    

    Delete left over files and folders (which also removes any databases):

    rm -f /var/log/mariadb
    rm -f /var/log/mariadb/mariadb.log.rpmsave
    rm -rf /var/lib/mysql
    rm -rf /usr/lib64/mysql
    rm -rf /usr/share/mysql
    

    Put back the copy of /usr/lib64/libmysqlclient.so.18 you made at the start and you can restart postfix.

    There is more detail at https://code.trev.id.au/centos-7-remove-mariadb-replace-mysql/ which describes how to replace mariaDB with MySQL

提交回复
热议问题