[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Fixing corrupt mysql table



Robert S wrote:
> Subject: Re: Fixing corrupt mysql table
> I recently rebooted my server and mysql didn't start - it reported
> password problems.  I have reset the root password but there are
> other errors:
> 
> # /etc/init.d/mysql start
> Starting MySQL database server: mysqld.
> Checking for corrupt, not cleanly closed and upgrade needing tables..
> ERROR 1045 (28000): Access denied for user
> 'debian-sys-maint'@'localhost' (using password: YES)

Your subject asks about corrupt tables but the error message is purely
one of an incorrect password.  You have apparently deleted the
debian-sys-maint user.

The message "Checking for corrupt, not cleanly closed and upgrade
needing tables.." is always printed out by the init script.  I think
that is an unfortunate choice.  Because of this it always looks like
it has corrupt tables but it is just a status message that it is going
to do the check before doing it and it always does it at init time.

The error message says that the package's administrative account has
been lost.  This is a Debian specific user created by the package for
automated system maintenance.   You simply need to restore it.

First read /usr/share/doc/mysql-server-5.1/README.Debian.gz for
useful information including this:

  * MYSQL WON'T START OR STOP?:
  =============================
  You may never ever delete the special mysql user "debian-sys-maint". This
  user together with the credentials in /etc/mysql/debian.cnf are used by the
  init scripts to stop the server as they would require knowledge of the mysql
  root users password else.
  So in most of the times you can fix the situation by making sure that the
  debian.cnf file contains the right password, e.g. by setting a new one
  (remember to do a "flush privileges" then).

> Will it be necessary to rebuild everything from scratch?

No.  You just need to recreate the administrative account.

> I've got a lot of it running temporarily by using the root user and
> password in a few scripts but how can I restore the system?

I have not found myself in that situation before and do not have a
canned answer.  But I think it can be easily corrected simply by
reconfiguring the package.  By inspection of the package's postinst
script /var/lib/dpkg/info/mysql-server-5.1.postinst leads me to
believe that it always attempts to correctly set up that user every
time it runs.  So not sure but I think this should do it.  But I
haven't tested this and so do not know.  Always make sure you have a
good backup first.

  # dpkg-reconfigure mysql-server-5.1

Please report back on the results.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: