I am new to ubuntu. I am trying to uninstall mysql-server, while i'm doing it the purging process gets stuck at the line Renaming removed key_buffer and myisam-recover options (if present) and later on errors back saying E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. Can someone help me with this? I am using ubuntu 14.04lts. I tried doing what the error tells sudo dpkg --configure -a but it also errors back saying dpkg: error: dpkg status database is locked by another process.
3 Answers
It looks that /var/cache/debconf/config.dat is locked by another process. Please remove it first by executing following steps.
service mysqld status ps aux | grep mysql sudo service mysql stop kill -9 mysql_pid rm -rf /var/cache/debconf/config.dat Then you can try to purge MySQL:
sudo apt-get purge mysql-server 1You probably want to stop the mysql service before purging it.
You can see running services with:
sudo service --status-allThen, you can stop the mysql service running
sudo service mysql stopThe service is now stopped, try again
sudo apt-get purge mysql-server
Once done, you can try to re-install the mysql-server:
sudo apt-get update sudo apt-get install mysql-server While these steps should be enough, you can head to Cannot reinstall mysql-server after its purge and follow the provided steps to clean all your mysql setup.
4I had this problem earlier, just finally fixed it. These are the steps that worked for me.
mysqldump --lock-all-tables -u root -p --all-databases > dump.sql sudo apt-get remove --purge mysql* sudo apt-get autoremove sudo apt-get autoclean sudo rm -r /etc/mysql sudo rm -r /var/log/mysql sudo apt-get install mysql-server sudo mysql -u root -p < dump.sql sudo service mysql restart