2

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 Answers3

3

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
David Foerster
  • 36,890
  • 56
  • 97
  • 151
Ramesh Chand
  • 7,564
0

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.

ponsfrilus
  • 596
  • 1
  • 5
  • 17
0

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

http://teachmelinux.com/2017/01/ubuntu-server-mysql-5-7-update-failure-fix/

David Foerster
  • 36,890
  • 56
  • 97
  • 151