Author |
Message |
scanman717
|
Posted: Thu Mar 26, 2009 7:01 pm |
|
Joined: Wed Dec 14, 2005 4:42 pm
Posts: 59
|
knoppmyth r5f27
Had a power outage the other day... Backup battery didn't hold.
This is what I get when I try and start mythbackend from root prompt
2009-03-26 20:01:24.266 Using runtime prefix = /usr
2009-03-26 20:01:24.319 New DB connection, total: 1
2009-03-26 20:01:24.322 Unable to connect to database!
2009-03-26 20:01:24.322 Driver error was [1/2002]:
QMYSQL3: Unable to connect
Database error was:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
QSqlQuery::exec: database not open
QSqlQuery::exec: database not open
2009-03-26 20:01:24.377 DB Error (KickDatabase):
Query was:
SELECT NULL;
No error type from QSqlError? Strange...
2009-03-26 20:01:24.429 Failed to init MythContext, exiting.
I have no clue where to start to figure this one out... Is there a way to re-install mysql and re-use the existing DB's???
Thanks!!
_________________ Knoppmyth R5F27
|
|
Top |
|
|
tjc
|
Posted: Thu Mar 26, 2009 7:56 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
|
Top |
|
|
scanman717
|
Posted: Thu Mar 26, 2009 8:47 pm |
|
Joined: Wed Dec 14, 2005 4:42 pm
Posts: 59
|
Yeah, Disaster recovery is not really what I am after.. If it gets that far, I will just go with a new hard drive and start over...
Tried the Repair MythConvergDB Wiki article.. No luck.
Still getting the unable to connect message...
When I try and start mysql I get : DBI connect('database=mythconverg:host=mythtv','mythtv',...) failed: Can't connect to MySQL server on 'mythtv'
MySQL is not starting..
Mar 26 21:42:14 mythtv /etc/init.d/mysql[6547]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'$
Mar 26 21:42:14 mythtv /etc/init.d/mysql[6547]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
_________________ Knoppmyth R5F27
|
|
Top |
|
|
tjc
|
Posted: Fri Mar 27, 2009 10:44 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Have you tried starting the mysql server manually and/or checking the log files at /var/log/mysql.log, /var/log/mysql.err or in the /var/log/mysql directory?
Code: /etc/init.d/mysql stop ; sleep 5 ; /etc/init.d/mysql start
|
|
Top |
|
|
scanman717
|
Posted: Sat Mar 28, 2009 7:32 am |
|
Joined: Wed Dec 14, 2005 4:42 pm
Posts: 59
|
Yep..
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
Those logfiles are empty... and in /var/log/mysql there are some files from 2007....
I think I may try an auto update.
_________________ Knoppmyth R5F27
|
|
Top |
|
|
tjc
|
Posted: Sat Mar 28, 2009 3:38 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Have you tried the optimize_db.sh script? It falls back on a slower low level repair method that may work where the faster/simpler one doesn't.
OBTW, you might also want to try repairing the mysql schema since that could also be roached.
|
|
Top |
|
|
scanman717
|
Posted: Sat Mar 28, 2009 8:48 pm |
|
Joined: Wed Dec 14, 2005 4:42 pm
Posts: 59
|
Yep. Ran that script. Also did it by hand....
How do I repair the MySQL Schema??? Not a software guy... Routers and Switches all day long, but not so much on the software.
BTW, thanks tjc, I really appreciate the assistance.
_________________ Knoppmyth R5F27
|
|
Top |
|
|
tjc
|
Posted: Sat Mar 28, 2009 9:24 pm |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Look at the commands inside the script. Instead of the mythconverg directory you want to go to the mysql directory, then run the myisamchk command (as root of course)...
Code: cd /var/lib/mysql/mysql /usr/bin/myisamchk --safe-recover *.MYI
The script tries to do this both intelligently and safely (shutting down servers, trying the fast way first, ...) but it's wired up to only work for the myth DB rather than the mysql master schema.
|
|
Top |
|
|
scanman717
|
Posted: Sat Mar 28, 2009 10:30 pm |
|
Joined: Wed Dec 14, 2005 4:42 pm
Posts: 59
|
Still no go...
Also tried:
Code: mysqlcheck -u root -p --auto-repair --check --optimize --all-databases Enter password: mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect root@mythtv:/home/mythtv#
Is there a lock file or something that might not have cleared when it lost power??
If all else fails, can I simply re-install the MySQL portion of knoppmyth? Or maybe just the tables?? I mean I don't really care about the data in the DB, I can reset my schedules, and everything I recorded that I wanted to keep is elsewhere. I just have lots of other stuff running on this box that I would not rather go through the hassles of doing a full re-install
_________________ Knoppmyth R5F27
|
|
Top |
|
|
scanman717
|
Posted: Sat Mar 28, 2009 10:57 pm |
|
Joined: Wed Dec 14, 2005 4:42 pm
Posts: 59
|
Ok, more info.....
As root I ran:
Code: mysqld_safe --skip-grant-tables &
Then in another terminal window, as root I started mythbackend.. It appears to run correctly..
Right now it is running.... But this is not optimal.. So how do I get it back to running the way it should??
_________________ Knoppmyth R5F27
|
|
Top |
|
|
tjc
|
Posted: Sun Mar 29, 2009 10:20 am |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
Excellent! That sounds much more hopeful. I was afraid that your mythconverg DB was badly corrupted and a backup/restore would just recreate the same issues. While I should probably know how to re-init the mysql DB manually, it's generally easier to do a backup and "auto-upgrade" to the same version. See the R5.5 hints for some things to do to make sure you capture all your tweaks.
OBTW - If you run into a problem with the backup, stop and holler. It may or may not be something you can ignore but it may not be obvious which.
|
|
Top |
|
|
pmljr
|
Posted: Sun Apr 19, 2009 6:55 pm |
|
Joined: Wed Mar 04, 2009 2:56 pm
Posts: 23
Location:
Trumbull, CT
|
I've just suffered the same problem. Lost power and now on boot I get this: Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed! I have run the repair sequence: Code: cd /var/lib/mysql/mythconverg /etc/init.d/mythtv-backend stop /etc/init.d/mysql stop myisamchk -f -r *.MYI then attempted to restart mysql by: Code: /etc/init.d/mysql start which results in: Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed! When I try: Code: mysqlcheck -c -umythtv -pmythtv mythconverg I get this message: mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mythsqld/mysqld.sock' (2) when trying to connect
So I'm wondering if anyone has recovered from this.
I can reinstall the whole thing, but then what happens next time the power drops out? I'd rather figure out how to fix it.
Perhaps there is some way to fix mysql without doing a full reinstall.
Ideas?
|
|
Top |
|
|
scanman717
|
Posted: Sun Apr 19, 2009 7:55 pm |
|
Joined: Wed Dec 14, 2005 4:42 pm
Posts: 59
|
So far I have done nothing else.. Still running the way I did in the last post and it is running fine... Of course everytime I reboot I have to manually do the commands.... But, I don't have time to re-install right now.
I would love to hear if there is a solution out there?
_________________ Knoppmyth R5F27
|
|
Top |
|
|
tjc
|
Posted: Mon Apr 20, 2009 9:42 am |
|
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location:
Arlington, MA
|
What do this show?
Code: ls -al /var/run/mysqld /var/lib/mysql
You may also want to try to start the DB manually as above and check the mysql.user table. There should be 4 rows, "root", "debian-sys-maint", and two "mythtv" enties (one for local access and the other for remote),
|
|
Top |
|
|
pmljr
|
Posted: Mon Apr 20, 2009 6:04 pm |
|
Joined: Wed Mar 04, 2009 2:56 pm
Posts: 23
Location:
Trumbull, CT
|
The response to the command:
Code: ls -al /var/run/mysqld /var/lib/mysql was /var/lib/mysql: total 20552 drwxr-xr-x 5 mysql mysql 4096 Apr 19 21:01 . drwxr-xr-x 44 root root 4096 Apr 20 2008 .. -rw-r--r-- 1 mysql mysql 0 Jun 2 2007 debian-5.0.flag -rw-rw---- 1 mysql mysql 5242880 Apr 19 21:01 ib_logfile0 -rw-rw---- 1 mysql mysql 5242880 Nov 5 2006 ib_logfile1 -rw-rw---- 1 mysql mysql 10485760 Apr 18 20:44 ibdata1 drwxr-xr-x 2 mysql mysql 4096 Apr 18 22:14 mysql -rw------- 1 mysql mysql 4 Nov 5 2006 mysql_upgrade.info -rw------- 1 root root 6 Jun 2 2007 mysql_upgrade_info drwx------ 2 mysql mysql 8192 Apr 19 19:22 mythconverg drwx------ 2 mysql mysql 4096 Sep 26 2007 zm
/var/run/mysqld: total 8 drwxr-xr-x 2 mysql root 4096 Apr 18 20:44 . drwxr-xr-x 15 root root 4096 Apr 19 21:01 ..I tried starting DB manually using: Code: /etc/init.d/mysql stop ; sleep 5 ; /etc/init.d/mysql start
I still get the response
Stopping MySQL database server: mysqld. Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
But how do I check the mysql.user table? Can I check it if mysqld failed?
|
|
Top |
|
|