I really messed up my mysql installation trying to rapidly setup Owncloud on a new install of Ubuntu 20.04 LTS server. Sadly I already setup many services that are running well, so I just want to completely purge mysql and setup again from scratch. I have tried following various tutorials about
sudo apt-get purge mysql*
However, all variations end with this very similar error and I cannot continue and trying to ignore and re-install mysql just fails. How can I force remove all mysql of this box and start that again?
Thanks for any help.
Error: (Reading database … 160886 files and directories currently installed.) Removing mysql-server-8.0 (8.0.23-0ubuntu0.20.04.1) … 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 dpkg: too many errors, stopping Failed to stop mysql.service: Unit mysql.service not loaded. invoke-rc.d: initscript mysql, action “stop” failed. Failed to start mysql.service: Unit mysql.service not found. invoke-rc.d: initscript mysql, action “start” failed. Unit mysql.service could not be found. dpkg: error while cleaning up: installed mysql-server-8.0 package post-installation script subprocess returned error exit status 1 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)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
In addition to what KFSys already mentioned, I could suggest also taking a look at this answer here:
https://www.digitalocean.com/community/questions/completely-uninstall-mysql-server
Regards, Bobby
Hi @jonathankonrad,
I’ve had the same issue before. What it worked for me in that case was :
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysqlthen
Please give it a try one more time and see if it would work that way.
Looking forward to your reply!
Regards, KFSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.