[mythtv-users] program.MYD not found
Michael T. Dean
mtdean at thirdcontact.com
Fri Mar 20 17:26:10 UTC 2009
On 03/20/2009 09:50 AM, Sarvin C. wrote:
> On Thu, Mar 19, 2009 at 11:02 PM, Michael T. Dean wrote:
>
>> Check the MySQL data directory (usually something like /srv/mysql or
>> (*shudder*) /var/lib/mysql ) to see if the directory and file exist and
>> verify permissions on them.
>>
>> If the file doesn't exist, let me know, and I'll send you instructions for
>> fixing your DB.
> The file doesn't exist.
At this point, then, I would assume that your database schema is
completely broken. So, the best fix would be to recreate the entire schema.
Before I go any farther, I should probably mention that I'm assuming you
have done a proper installation of MythTV and that you (at one point)
had a working database. If that's not true, the rest of this is not
really relevant, and you just need to do a proper install. (However,
I'm nearly certain that you could not get the error you're getting if
you hadn't had a valid program table at one point.).
So, the plan will be to a) backup your old database, b) drop the old
database, c) run mc.sql to create a new database, d) run mythtv-setup or
mythbackend and mythfrontend to create a new database schema, and e)
restore only the "critical" portions of your database data. The
specific procedure is:
a) Backup your old database. There are scripts describe (and linked)
at: http://www.mythtv.org/wiki/Database_Backup_and_Restore that work
very well for backup and restore (of non-broken databases ;). However,
since your database is missing some files, you may not be able to use
them without some "up-front work." First test the script by (after
configuring it as described in the wiki page), running
"mythconverg_backup.pl --verbose --directory=${HOME}" (no quotes).
If that gives an error about the missing table/inability to open
program.MYD, you can try doing something as simple as "touch
/srv/mysql/mythconverg/program.{MYD,MYI,frm}" (and, if other files are
missing--which would be reported by the backup script the same way as
you saw above with program.MYD, do the same for them). Then, try to run
the backup script, again.
If that still gives an error, use the mysql client and issue the
command, "DROP TABLE IF EXISTS program;" (and repeat for any other
tables that are listed as missing). Again, try to run the backup
script, again.
If that still doesn't work, we'll have to manually grab the data we
want... Run the command:
mysqldump -umythtv -pmythtv mythconverg -c \
--tables record recorded oldrecorded recordedprogram \
recordedrating recordedmarkup recordedseek \
> $HOME/mythtv_backup.sql
If you get errors from that command, some of the "important" data is
missing. Remove each table name from the command until it completes
successfully, then let me know what tables are giving you errors and
I'll let you know how important the data is/how to recreate it. Note
that with this final "manual" approach, you will lose /all/ of your
plugin data (music, videos that aren't recordings, gallery, etc. data).
The above approaches would be preferred because they'll get all the data
that's in the database.
b) At this point, we've got the data (at least all the data we're going
to get) from the database, so we need to drop the database. If you had
errors in step a), above, you may want to wait until we've discussed
them to see if you want to proceed. Once you're ready to proceed, using
the mysql client, issue the command, "DROP DATABASE IF EXISTS
mythconverg;" Doing so may require the use of the MySQL root user
(which is /not/ the same as the system root user). If you have
questions about how to get the password for the MySQL root user, please
ask here or in IRC ( #mythtv-users on freenode) and someone who uses
your distro can likely help.
c) Now, we're ready to create a new database. It is critical you do so
by running the mc.sql script that's shipped with MythTV. Most distros
tend to put the script in the mythtv share directory (i.e.
/usr/share/mythtv/mc.sql or something). Note that you will almost
definitely require the MySQL root user to run this command. You can
find instructions for running mc.sql at
http://www.mythtv.org/wiki/Database_Backup_and_Restore#Database_Restore .
d) At this point, we're ready to create the database schema. This is
done by either mythtv-setup or mythbackend. All you need to do is run
the program once and then shut it down and the schema should be
created. If you're restoring only the "critical" TV data (information
about your previous recordings), then just run mythtv-setup, then exit
mythtv-setup.
If you want to restore your plugin data, too (and if you actually got a
good backup with the script in step a) above), you'll need to run
mythbackend and mythfrontend (as mythfrontend will create the plugin
portion of the database schema) before restoring data. That also means
that you'll need to partially configure mythbackend before it will
continue to run. Run either mythtv-setup or mythbackend to create the
initial schema (if you ran mythbackend, it may shut down after running,
in which case you'll need to run mythtv-setup and configure the General
settings). Exit mythtv-setup, if you're still inside it. Once you've
been able to start mythbackend and it continues to run, start
mythfrontend. Then, shut down mythfrontend and mythbackend.
e) At this point we're ready to restore the data. If you got a full
backup using the scripts in step a) above, this approach will restore
the critical TV data and the plugin data. If you did a "partial backup"
using the manual approach in step a) above, it will only restore the
critical TV data, in spite of the fact that we're using instructions
that say it will restore plugin data (only because there /is/ no plugin
data in the backup we're restoring). If, however, you got a full backup
from the script but you do /not/ want to restore plugin data (you want
to recreate it), you may do so as described later.
To restore the critical TV data and the plugin data, follow instructions
at:
http://www.mythtv.org/wiki/Database_Backup_and_Restore#Partial_restore_of_a_backup.2C_including_plugin_data
. Make sure you specify the "--directory=$HOME" argument, too (if you
used the "--directory=${HOME}" argument to the backup script, as I
mentioned above). Also, if you did a manual backup, you'll need to use
the argument "--filename=$HOME/mythtv_backup.sql". I also recommend
using the --verbose argument to ensure that you are restoring the proper
backup file.
To restore the critical TV data only if you have a full backup, you may
follow instructions at:
http://www.mythtv.org/wiki/Database_Backup_and_Restore#Partial_restore_of_a_backup
, but note there's a small bug in the restore script that requires you
to apply the patch at: http://svn.mythtv.org/trac/ticket/6013 .
At this point, you should have all the useful data salvaged and a good
database. Now, you just need to go into mythtv-setup and reconfigure
your system. Then, start mythbackend, then mythfrontend and use
mythfrontend settings to reconfigure the frontend.
Good luck. Feel free to ask if you have questions or if there are
problems with this approach.
Mike
(Now do you see why I didn't want to write this out until I got
confirmation from you that the file didn't exist? :)
More information about the mythtv-users
mailing list