Issue
I'm trying out this command to completely remove mysql from an aws instance Ubuntu 20.04.1 LTS
sudo apt-get remove mysql*
But it's throwing all kinds of errors:
// important ones:
Failed to stop mysql.service: Unit mysql.service not loaded.
invoke-rc.d: initscript mysql, action "stop" failed.
dpkg: error processing package mysql-server-8.0 (--remove):
installed mysql-server-8.0 package pre-removal script subprocess returned error exit status 1
and then at the end:
Errors were encountered while processing:
mysql-server-8.0
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
when I type out:
whereis mysql
I see:
mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
I'm pretty sure I messed up somewhere during it's removal and I'm not sure how to get it back on track.
Is there a way to purge everything without using the dpkg?
Thanks.
Solution
As seen here:
sudo systemctl disable mysql
sudo apt remove mysql*
sudo apt purge mysql*
sudo apt autoremove
I also deleted know mysql files and directories:
sudo rm -r /etc/mysql /var/lib/mysql /var/log/mysql
And the files and directories shown when running
whereis mysql
Answered By - dxvargas