Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I was installing mysql with apt-get install mysql-server (like I always did) before that I had done an apt-get update (I am using Debian 6), and when I installed I found this problem, pretty common as I see, but Ive followed all stepts and nothing have worked,

Ive tried with apt-get install -f also with apt-get remove mysql-server (and common, and mysql-server-5.1) and also with apt-get purge (every packate) and later install, but nothing...

I tried also

dpkg-reconfigure mysql-server-5.1
apt-get install --reinstall mysql-server
(all runed as Root)

Still, nothing worked, any idea???

130130 10:11:48  InnoDB: Shutdown completed; log sequence number 0 44233
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

    dpkg: dependency problems prevent configuration of mysql-server:

mysql-server depends on mysql-server-5.1; however:
Package mysql-server-5.1 is not configured yet.
dpkg: error processing mysql-server (--configure):
dependency problems - leaving unconfigured
configured to not write apport reports
Errors were encountered while processing:
     mysql-server-5.1
     mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

when I tried

dpkg-reconfigure mysql-server-5.1


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

the case "Start" on /etc/init.d/mysql is

'start')
        sanity_checks;
        # Start daemon
        log_daemon_msg "Starting MySQL database server" "mysqld"
        if mysqld_status check_alive nowarn; then
           log_progress_msg "already running"
           log_end_msg 0
        else
            # Could be removed during boot
            test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld

            # Start MySQL!
            /usr/bin/mysqld_safe > /dev/null 2>&1 &

            # 6s was reported in #352070 to be too few when using ndbcluster
            for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
                sleep 1
                if mysqld_status check_alive nowarn ; then break; fi
                log_progress_msg "."
            done
            if mysqld_status check_alive warn; then
                log_end_msg 0
                # Now start mysqlcheck or whatever the admin wants.
                output=$(/etc/mysql/debian-start)
                [ -n "$output" ] && log_action_msg "$output"
            else
                log_end_msg 1
                log_failure_msg "Please take a look at the syslog"
            fi
        fi

When I make mysql force-reload:

Reloading MySQL database server: mysqld/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
root@americandougnuts:/etc/init.d#
root@americandougnuts:/etc/init.d# Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
share|improve this question
    
check the rights for /tmp and /var/tmp directories –  jet Jan 31 '13 at 16:57
    
When you ran apt-get install --reinstall mysql-server, did you get any error messages? If so, what? I'd go back and run that again to see what happens. –  Jenny D Feb 28 '13 at 11:14

3 Answers 3

For some reason apt-get upgrade creates a new mysql bin file which doesn't have the correct ownership. This file is located in /var/lib/mysql. Because mysql can't access this file mysql can't start and the upgrade fails.

Check the file ownership of the files in /var/lib/mysql

ls -ltra /var/lib/mysql


-rw-rw----  1 mysql root        125 Oct 29 09:53 mysql-bin.000288
-rw-rw----  1 mysql root        125 Oct 29 09:53 mysql-bin.000289
-rw-rw----  1 mysql mysql       228 Oct 29 10:07 mysql-bin.index
-rw-rw----  1 root  root        125 Oct 29 10:07 mysql-bin.000291
-rw-rw----  1 root  root        125 Oct 29 10:07 mysql-bin.000290

Dirty workaround:

  • open a second terminal
  • while true; do chown mysql:mysql /var/lib/mysql/*; done

  • in the original terminal

  • apt-get upgrade -y

when the upgrade is successfully completed CRT+C the while loop in the second terminal.

share|improve this answer

It says why it doesn't work in the output you shared:

Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!

MySQL refuses to start, check MySQL's log files in /var/log to find out why, fix it and run dpkg-reconfigure again.

share|improve this answer
    
Thank you! the log is empty... also the logs on var/log/mysql –  user156355 Jan 31 '13 at 1:39
    
look at the init script how exactly mysql is started (hint: bash -xv /etc/init.d/mysql start) and try starting it manually in verbose/debug mode (see man manpage on how to do this). –  fuero Jan 31 '13 at 1:43
    
Thank you, I checked the file, and I updated my comment, im going to start it on debug mode –  user156355 Jan 31 '13 at 1:53
    
I didnt find debug mode, but when I make force-reload it appears: Reloading MySQL database server: mysqld/usr/bin/mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists! root@americandougnuts:/etc/init.d# root@americandougnuts:/etc/init.d# Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists! –  user156355 Jan 31 '13 at 2:05

run just "mysqld" in a shell as root to start mysql. It should then print to the screen why it fails to start. Often it an obsolete configuration option in /etc/mysql/my.cnf.

After you correct the error keeping mysql from starting, re-run dpkg-reconfigure mysql-server-5.1

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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