The mySQL on my friend's Knoppmyth R5.5 machine won't start, following a power failure.The machine starts and runs, but since mySQL isn't running, mythtv can't do anything.

Since SSH still works fine, I looked around his machine via SSH.I can see that mythtv keeps trying to connect to the database (over and over) and fails.The Mythtv backend log shows:

Code:

Cannot login to database?

Would you like to configure the database connection now? [yes][console is not interactive, using default 'yes']Database host name: [localhost][console is not interactive, using default 'localhost']Should I test connectivity to this host using the ping command? [yes][console is not interactive, using default 'yes']Database non-default port: [0][console is not interactive, using default '0']Database name: [mythconverg][console is not interactive, using default 'mythconverg']Database user name: [mythtv][console is not interactive, using default 'mythtv']Database password: [mythtv][console is not interactive, using default 'mythtv']Unique identifier for this machine (if empty, the local host name will be used)$[console is not interactive, using default '']

I looked at his syslog file a day or 2 after the power failure.It looks like power died around 3pm on Oct.3. When power came back at 5pm (17:04 hours), it booted and mysql detected the crash:

I was NOT able to extract any .deb files from the big KNOPPIX file. (It would still be good to know how Cecil does it.)I was able to connect to an archived repository from 2008 and pull the same version of the mysql-server-5.0.Unfortunately the dpkg process did NOT fully complete, so I wasn't able to reinstall mysql-server-5.0.It turns out that reinstalling mysql-servre-5.0 would not have helped in this case, anyway.

I did finally get hold of my friend Brad to look at this with me. He was able to get mysql started and forced a rebuild of the damaged database.He looked at the error messages and saw that the "db" table (part of the "mysql" database) was the corrupted one - not the mythtv "mythconverg" database.

Here is Brad's description of what he had to do to fix the database problems.

Quote:

It was fairly easy to fix once the exact problem was understood.

I didn't cut any log or error snippets, but the key error message ended up being:

mySQL stores data on disk organized fairly logically - /var/lib/mysql is the base directory, and sub-directories are different databases, with the file groups in those directories being individual table information (generally).

The mySQL privilege information determines what users have access to which data, and is stored in the "mysql" database in the "db" table. The confusing part was that the error was complaining about an incorrect file format ('db'), which led me to think that somehow the format of a table was changed to something inappropriate.

However, what the error actually is trying to say is "table 'db' has an incorrect file format" - in other words, it's corrupted.

So, I started the mySQL server on a separate VTTY in a mode that essentially bypassed the privilege/user mechanism (and related tables):

Code:

mysqld --skip-grant &

From there, I could start the mySQL command line console on another VTTY. Because the privilege/user mechanism had been bypassed, I checked to see that the user table was OK by manually inserting a new user.

However an error similar to the original error above appeared on the VTTY that mysqld was launched from, as well as a warning indicated on command execution within the command line interface (but no specifics).

From the command line console,

Code:

repair table db;

showed that it was damaged/corrupt, and normal repair methods weren't going to work.

Although this is generally used as a last resort, I opted to take a more blunt approach and force it to try and recreate the MYI information from the FRM file -

Code:

repair table db use_frm;

Ultimately, that is what brought some level of functionality back. Although, deleting the "db" table and restoring/recreating it would have allowed things to start again, it would likely have smashed the MythTV functionality and required a lot more forensic rebuilding than I had time or patience to do.

All is working again on the Knoppmyth R5.5 machine. In the end, it was a corrupted mysql database file! The trick was getting mysql to start up in a broken state!

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum