Unable to purge mysql -server

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.

1

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
1

You probably want to stop the mysql service before purging it.

  1. You can see running services with:

    sudo service --status-all
  2. Then, you can stop the mysql service running

    sudo service mysql stop
  3. The 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.

4

I 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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like