22

How do I completly remove MariaDB so I can reset the root password?

SteamPunk_Devil
  • 323
  • 1
  • 2
  • 4
  • 5
    Sorry? What does the 1st have to do with the 2nd? And even if you did mean to reset the password for connecting to the database and not the root password: what does that have to do with removing mariadb? – Rinzwind Aug 03 '16 at 08:23
  • 1
    and how did you install mariadb? apt-get? source tarball? – Rinzwind Aug 03 '16 at 08:27
  • I used apt-get I need to pretty much reset all the passwords to it but think Ive broken it to the stage a complete reset is easier than doing it manually – SteamPunk_Devil Aug 03 '16 at 08:34
  • 1
    Re-installing the packages won't reset the database or its configuration though. This sounds like an [XY Problem](//meta.stackexchange.com/q/66377/271411). I think your question would be better along the lines of: “I broke my MariaDB installation and probably need to reset its root password. So far I tried […] to achieve that but it wasn't successful/seems to have made things worse. How can I proceed?” I won't vote to close it as unclear because there's a helpful answer though. – David Foerster Aug 04 '16 at 10:13

1 Answers1

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.

Zanna
  • 69,223
  • 56
  • 216
  • 327
Rinzwind
  • 293,910
  • 41
  • 570
  • 710