Remove MariaDB or MySQL from CentOS 7, Completely remove MariaDB or MySQL from CentOS 7 or RHEL 7,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 remove mariadb mariadb-server”, after that I reinstalled it with “yum install mariadb mariadb-server”.
Unfortunately, the configuration remains. It seems as if yum remove don’t delete all MariaDB Config-Files.
How can I remove MariaDB completely from CentOS 7?
These steps are working on CentOS 6.5 so they should work on CentOS 7 too:
(EDIT – exactly the same steps work for MariaDB 10.3 on CentOS 8)
yum remove mariadb mariadb-server
rm -rf /var/lib/mysqlIf your datadir in /etc/my.cnf points to a different directory, remove that directory instead of /var/lib/mysql
rm /etc/my.cnfthe file might have already been deleted at step 1
- Optional step:
yum install mariadb mariadb-server
[EDIT] – Update for MariaDB 10.1 on CentOS 7
The steps above worked for CentOS 6.5 and MariaDB 10.
I’ve just installed MariaDB 10.1 on CentOS 7 and some of the steps are slightly different.
Step 1 would become:
yum remove MariaDB-server MariaDB-client
Step 5 would become:
yum install MariaDB-server MariaDB-client
The other steps remain the same.
See More: SQL Check if table exists
One thought on “Completely remove MariaDB or MySQL from CentOS 7 or RHEL 7”