I've been trying to uninstall and reinstall MySQL on Ubuntu 16.04, I've seen plenty of methods but I can't figure out why I'm getting an error.
$ sudo apt-get install mysql-server mysql-server is already the newest version (5.7.17-0ubuntu0.16.04.2). The following package was automatically installed and is no longer required: snap-confine Use 'sudo apt autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 2 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] Setting up mysql-server-5.7 (5.7.17-0ubuntu0.16.04.2) ... Renaming removed key_buffer and myisam-recover options (if present) Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details. invoke-rc.d: initscript mysql, action "start" failed. ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Mi 2017-04-26 12:15:04 EEST; 5ms ago Process: 13693 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE) apr 26 12:15:04 alex-X750JB systemd[1]: Failed to start MySQL Community Server. apr 26 12:15:04 alex-X750JB systemd[1]: mysql.service: Unit entered failed state. apr 26 12:15:04 alex-X750JB systemd[1]: mysql.service: Failed with result 'exit-code'. dpkg: error processing package mysql-server-5.7 (--configure): subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of mysql-server: mysql-server depends on mysql-server-5.7; however: Package mysql-server-5.7 is not configured yet. dpkg: error processing package mysql-server (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. Errors were encountered while processing: mysql-server-5.7 mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1) I've tried these steps:
sudo apt-get purge mysql* sudo apt-get autoremove sudo apt-get autoclean sudo apt-get dist-upgrade sudo apt-get install mysql-server Everything goes well, until I use sudo apt-get install mysql-server
If I run systemctl status mysql.service:
● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: inactive (dead) (Result: exit-code) since Mi 2017-04-26 13:30:19 EEST; 11min ago Process: 17650 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE) apr 26 13:30:18 alex-X750JB systemd[1]: Failed to start MySQL Community Server. apr 26 13:30:18 alex-X750JB systemd[1]: mysql.service: Unit entered failed state. apr 26 13:30:18 alex-X750JB systemd[1]: mysql.service: Failed with result 'exit-code'. apr 26 13:30:19 alex-X750JB systemd[1]: mysql.service: Service hold-off time over, scheduling restart. apr 26 13:30:19 alex-X750JB systemd[1]: Stopped MySQL Community Server. apr 26 13:30:19 alex-X750JB systemd[1]: mysql.service: Start request repeated too quickly. apr 26 13:30:19 alex-X750JB systemd[1]: Failed to start MySQL Community Server. 121 Answer
I followed the instructions from here and i managed to reinstall mysql-server and it ran.
1