I have been trying to remove all the package.
apt-get remove --purge mysql*
apt-get remove --purge mysql
apt-get remove --purge mariadb
apt-get remove --purge mariadb*
apt-get --purge remove mariadb-server
apt-get --purge remove python-software-propertiesBut after apt-get remove --purge mysql*, they need me to run apt --fix-broken install first
Try to remove mariadb apt-get remove --purge mariadb* and get
`Failed to stop mysql.service: Unit mysql.service not loaded.`
/usr/bin/deb-systemd-helper: error: unable to read mariadb.serviceTry to start mysql and get this
Failed to start mysql.service: Unit mysql.service not found.What should i do to remove all of it?
63 Answers
I had success dealing with a similar problem by following the some of the steps listed in this post.
Detect all MariaDB and MySQL packages
apt search mariadb | grep "\[install"and
apt search mysql | grep "\[install"
Unfortunately, before I was able to do the next step, I had to remove the various mariadb.service files, so that dpkg was able to remove the mariadb-server-10.3 package properly. Otherwise, it seems to be assuming there's a running service, and when it's unable to stop it (because the symlink is broken), it errors out.
I found mariadb.service in /etc/systemd/system and /etc/systemd/system/multi-user.target.wants
Force uninstall of all MariaDB and MySQL packages (server, client, libs) to clean the mess
sudo dpkg --force depends --purge <package> <package> ...
For the "Step 4" of that post, I swapped the order of the commands to remove the unneeded packages first:
sudo apt autoremove
sudo apt-get --fix-broken installAnd then I was able to reinstall per the normal
sudo apt install mariadb-serverHope that helps.
Try this:
Purge mariadb
sudo apt purge mariadb-*Remove all databases ('Yes' answer)
Purge mysql
sudo apt purge mysql-*Remove all databases ('Yes' answer)
Remove mariadb repo from
/etc/apt/sources.listFind something like this:
deb [arch=amd64,arm64,ppc64el] bionic mainRemove folders:
sudo rm -r /usr/share/mysql/ sudo rm -r /etc/mysql/ sudo rm -r /lib/systemd/system/mysql.serviceNow you can try to install oracle mysql:
sudo apt install mysql-server
You can completely uninstall mysql / mariadb as follow:
sudo apt-get purge mariadb-server mariadb-* mysql-*The purge is identical to remove, except that packages are removed and purged (any configuration files are deleted too)