How do I completely remove MariaDB so I can reset the root password?
Asked
Active
Viewed 1.1e+01k times
2 Answers
42
First, create a backup of {database}:
mysqldump -u {user} -p {database} > /home/$USER/Documents/backup.sql
To remove any trace of mariadb installed through apt-get:
sudo service mysql stop
sudo apt-get --purge remove "mysql*"
sudo rm -rf /etc/mysql/
and it is all gone. Including databases and any configuration file.
To check if anything named mysql is gone do a
sudo updatedb
and a
locate mysql
It should be fairly empty (maybe some manual pages or a connector). If though you see a my.cnf amongst the results remove that too.
-1
This is what worked for me on Kali Linux:
sudo dpkg --get-selections | grep mysql
sudo dpkg --get-selections | grep mariadb
Remove all the packages found by the above commands.
sudo dpkg --force depends --purge mysql-common
I found these libraries:
libdbd-mariadb-perl install
libmariadb-dev install
libmariadb-dev-compat install
libmariadb3:amd64 install
libmariadbd-dev install
libmariadbd19:amd64 install
mariadb-backup install
mariadb-client install
mariadb-client-core install
mariadb-common install
mariadb-plugin-provider-bzip2 install
mariadb-plugin-provider-lz4 install
mariadb-plugin-provider-lzma install
mariadb-plugin-provider-lzo install
mariadb-plugin-provider-snappy install
mariadb-server-core install
mariadb-test-data
default-libmysqlclient-dev:amd64 install
default-libmysqld-dev:amd64 install
default-mysql-client-core install
mysql-common deinstall
python3-mysqldb install
To remove them run
sudo apt autoremove
sudo apt autoclean
If any conflict comes up, you can use the dpkg command to remove a package and then reinstall if needed.
Zanna
- 72,312