Home‎ > ‎Tom's Ideas And Notes‎ > ‎

ZoneMinder DB table Config Corrupted

posted Nov 30, 2012, 5:04 PM by Tom Gutwin   [ updated May 7, 2013, 7:09 PM ]
This has happened two times now. At least the second time I had a DB backup so instead of re-initializing the config table  I re-loaded it.


First check if your disk is out of space.
These are the steps to recover...

steps to re-create CONFIG table

frankster says:

Make a copy of the

/usr/share/zoneminder/db/zm_create.sql

sql file and delete everything except the following sections:

  1. The line near the top that says "USE 'zm';"
  2. The section just below that has a "DROP TABLE" and "CREATE TABLE" applied to the "Config" table. This is 17 lines in my version of the sql file.
  3. The section that is about 620 lines into the file and starts with "delete from Config;" and has many lines beginning with "insert into Config...". This goes to the end of the file and is nearly 300 lines for me.

You now have an sql file that modifies the zoneminder (zm) database by deleting the config table and recreating it, then it initialises the configuration options to default values. This means you will lose all your settings if you apply this sql file to the database. However as you are seeing this error you have probably already lost all your settings.

To apply the script to the database you can use a command something like the following:

cat modifiedscript.sql | mysql -u root -p

Before you do this, I would recommend that you first verify that your Config table is empty:

mysql -u root -p
use zm;
select * from Config;

You should see "0 rows in set" if the Config table is empty (before you apply the sql script), or something like "218 rows in set" if it is full (after you apply the sql script).



My sql file is archived at /mnt/droboShare/media2/bak/zm/zm_recreateConfig.sql

Comments