I’m trying to install MySQL server on Ubuntu 16.04 using:

sudo apt-get install mysql-server

I get asked to set and confirm root password and then the install hangs at:

Renaming removed key_buffer and myisam-recover options (if present)

I’ve exited the install and purged MySQL and tried again, but the issue persists.


Same problem, found fix at https://omgdebugging.com/2016/09/04/fixing-hung-up-mysql-installation-on-ubuntu-16-04-lts/. I ran (as root) (sleep 200; killall mysqld)& then immediately apt-get install -y mysql-server mysql-client in my provisioning script.

| improve this answer | |
  • 1
    I ran: "killall mysqld" instead of the command mentioned here, then reinstalled, this worked for me. – Tisch Apr 27 '17 at 10:34
  • Thanks!!!! This is the unique way that I found in my searches to fix it. – Maykonn Jul 21 '17 at 15:28

After purging, check your /var/lib/mysql directory if it contains any files, and move those to other place or delete before trying to re-install.

| improve this answer | |
  • 2
    Thanks, I delete the files under /var/lib/mysql after a purge, still hangs on Renaming removed key_buffer and myisam-recover options (if present) – panthro Oct 11 '16 at 9:49

mysql often has problems with upgrades if you have used systemctl to disable it from starting at the same time as the OS.

Run systemctl status mysql.service as root and see if it started, and check if it is enabled or disabled. If it is disabled, run systemctl enable mysql.service, then run systemctl start mysql.service and then try upgrading again.

| improve this answer | |

Just incase the blog becomes a dead link in the future. This is the solution.

sudo rm -rf /var/lib/mysql to remove the leftovers.

| improve this answer | |

If you don't want to delete all of your databases... in my case this was an apparmor problem. I fixed it by disabling apparmor for mysqld with: apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.