How do I completly remove MariaDB so I can reset the root password?
Asked
Active
Viewed 1.1e+01k times
22
-
5Sorry? 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
-
1and 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
-
1Re-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 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.
-
// , I know this is Ask Ubuntu, but do you have any ideas for how to do this without using the package manager? – Nathan Basanese Nov 06 '18 at 00:37
-