1
apt-get remove mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libhtml-template-perl mysql-server-core-5.1 libevtlog0 mysql-server-5.1 libnet1
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  mysql-server
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 106 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 28208 files and directories currently installed.)
Removing mysql-server ...
Setting up mysql-server-5.1 (5.1.72-2) ...
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
configured to not write apport reports
Errors were encountered while processing:
 mysql-server-5.1
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@monitor:~#

I've had issues with MySQL not starting so I was going to reinstall it. Still will not go.

I've tried looking under /var/log for errors but I am not getting anything logged.

The config:

cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = Ku8MpmYWrX24hKSA
socket   = /var/run/mysqld/mysqld.sock
log = /var/log/mysql.log
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = Ku8MpmYWrX24hKSA
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr
log = /var/log/mysql.log

The log:

cat /var/log/mysql.log
root@monitor:~#

dpkg-reconfigure mysql-server-5.1
/usr/sbin/dpkg-reconfigure: mysql-server-5.1 is broken or not fully installed

What should I do to figure out why MySQL is not working right?

EDIT: I deleted all my.cnf files and reinstalled after a force uninstall. Still:

Setting up mysql-server-5.1 (5.1.72-2) ...
Stopping MySQL database server: mysqld.
/etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz ... (warning).
Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing mysql-server-5.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
configured to not write apport reports
                                      Errors were encountered while processing:
 mysql-server-5.1
E: Sub-process /usr/bin/dpkg returned an error code (1)
  • 1
    Have you tried running dpkg-reconfigure mysql-server-5.1? – Karlson Dec 17 '13 at 15:51
  • Yes, I have. I'll add that to post – Jason Dec 17 '13 at 16:05
  • It's weird that the removal script is trying to start the server. Please post the content of /var/lib/dpkg/info/mysql-server-5.1.prerm, and run DEBIAN_SCRIPT_DEBUG=1 apt-get remove mysql-server and post the transcript. – Gilles Dec 18 '13 at 0:13
1

You will need to reinstall the mysql-server-5.1. There is a question on the AskUbuntu that deals with this issue:

You can also try running:

sudo apt-get install --reinstall mysql-server-5.1

The other possibility is forced removal of the package:

sudo apt-get --purge remove --force mysql-server-5.1

as listed in one of the questions on SuperUser

EDIT

Trying to recall one of the issues I ran into when dealing with Debian and Ubuntu packages is the debian-sys-maint account. If the account doesn't exist in the databases user table similar errors can occur. This link also suggests several destinations of logs and solutions for this problem.

  • Removal isn't working. Forced removal doesn't help when the remove script is failing. Reinstall is unlikely to help, but in principle it could, if the postinst script happens to fix Frank's problem. – Gilles Dec 18 '13 at 0:10
0

I had similar problems just now. Note that a purge of the mysql packages leaves a variety of files behind, including the actual database files, which are in /var/lib/mysql, files in /etc/mysql, files in /var/log and the directory /var/log/mysql are left behind.

These files may cause problems, especially if they are from a different version of MySQL.

Try renaming all of these files (and directories) to *.orig and try again.

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.