Ubuntu: Mysql broken after update



Question:

I have an up to date Ubuntu 16.04 desktop. I installed a routine update today, which included a MySQL update. Mysql is now broken.

I followed the procedure here: 16.04 upgrade broke mysql-server but now I get: service mysql start Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.

root@civet:~# systemctl status mysql.service  ● mysql.service - MySQL Community Server     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en     Active: inactive (dead) (Result: exit-code) since Sat 2017-01-21 16:03:52 EST    Process: 32687 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=e    Process: 32686 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)    Process: 15576 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exi   Main PID: 32686 (code=exited, status=0/SUCCESS)    Jan 21 16:03:52 civet systemd[1]: Failed to start MySQL Community Server.  Jan 21 16:03:52 civet systemd[1]: mysql.service: Unit entered failed state.  Jan 21 16:03:52 civet systemd[1]: mysql.service: Failed with result 'exit-code'.  Jan 21 16:03:52 civet systemd[1]: mysql.service: Service hold-off time over, sch  Jan 21 16:03:52 civet systemd[1]: Stopped MySQL Community Server.  Jan 21 16:03:52 civet systemd[1]: mysql.service: Start request repeated too quic  Jan 21 16:03:52 civet systemd[1]: Failed to start MySQL Community Server.  root@civet:~# service mysql stop  root@civet:~# service mysql start  Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.  root@civet:~# journalctl -xe  -- Defined-By: systemd  -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel  --   -- Unit mysql.service has failed.  --   -- The result is failed.  Jan 21 16:06:09 civet systemd[1]: mysql.service: Unit entered failed state.  Jan 21 16:06:09 civet systemd[1]: mysql.service: Failed with result 'exit-code'.  Jan 21 16:06:09 civet systemd[1]: mysql.service: Service hold-off time over, sch  Jan 21 16:06:09 civet systemd[1]: Stopped MySQL Community Server.  -- Subject: Unit mysql.service has finished shutting down  -- Defined-By: systemd  -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel  --   -- Unit mysql.service has finished shutting down.  Jan 21 16:06:09 civet systemd[1]: mysql.service: Start request repeated too quic  Jan 21 16:06:09 civet systemd[1]: Failed to start MySQL Community Server.  -- Subject: Unit mysql.service has failed  -- Defined-By: systemd  -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel  --   -- Unit mysql.service has failed.  --   -- The result is failed.  

Any suggestions? Help would be appreciated.


Thanks. I have been using mysqldump to make daily backups for some time. I will employ automysqlbackup once I have mysql up and running again. I ran the remove --purge command, followed by the install, and this is what I got (it's been happening like this all day)

Renaming removed key_buffer and myisam-recover options (if present)  mysql_upgrade: Got error: 1524: Plugin 'mysql_old_password' is not loaded while connecting to the MySQL server  Upgrade process encountered error and will not continue.  mysql_upgrade failed with exit status 11  dpkg: error processing package mysql-server-5.7 (--configure):   subprocess installed post-installation script returned error exit status 1  No apport report written because the error message indicates its a followup error from a previous failure.                                                                                                            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  Processing triggers for systemd (229-4ubuntu16) ...  Processing triggers for ureadahead (0.100.0-19) ...  Errors were encountered while processing:   mysql-server-5.7   mysql-server  E: Sub-process /usr/bin/dpkg returned an error code (1)  

I just seem to be going around in circles. Also, the old_password workaround no longer works, so I tried set GLOBAL old_passwords=0;

If I try to connect to mysql I get: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) I have the socket set to that path in my.cnf


Solution:1

I suggest to back up, and then purge and reinstall mysql-server.

Can you install automysqlbackup ?

sudo apt-get install automysqlbackup  

Then run automysqlbackup from the command-line, and make also a backup of /etc directory :

sudo /usr/sbin/automysqlbackup    sudo rsync -av /etc/ $HOME/etc-backup/  

Check that automysqlbackup created the backups successfully :

sudo ls -la /var/lib/automysqlbackup/daily/  

After that remove the mysql server packages, purge the configuration, and reinstall mysql-server :

sudo apt-get remove --purge mysql-server*    sudo apt-get install mysql-server  

Put back your mysqldumps, by copying from the mentioned automysqlbackup "daily" dir, unzip the file, and then :

sudo mysql --defaults-file=/etc/mysql/debian.cnf    mysql> create database example-db;  mysql> quit    sudo mysql -u root -p example-db < example-db-daily.sql  

Do the same for all of your databases.


Solution:2

Problem solved by reinstall (twice) of mysql. However MySQL Workbench won't connect now, with error:

Error popup


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »