Revision [945]

This is an old revision of HOWTObackup made by PhilDaintree on 2007-12-01 17:44:52.

 

Guide to Backing Up and Restoring the Database


I recommend you look at using http://sourceforge.net/projects/automysqlbackup, to keep automatic backups of your webERP databases.

Its usage is simple and the documentation is provided.

Here are some notes on its usage:

Note: several automated MySQL backup programs use the 'mysqldump' utility to dump the tables. The web-based phpMyAdmin utility does not use 'mysqldump' and so avoids the following problems.

phpMyAdmin correctly dumps a INNODB database with foreign key constraints and allows easy restore.

As your database dump file gets bigger over time, you may not be able to use phpMyAdmin to restore the tables as you run into memory and timeout problems with Apache and PHP uploads. In this case you will need to use the command-line method as below.

But phpMyAdmin doesnt automate your backups. If you use automysqlbackup, or mysqldump, then you may face a problem.

mysqldump --opt, and automysqlbackup does not correctly dump a INNODB database with foreign key constraints. The restore will fail with an error 150.

Try the following to restore a database dump made in such a way (ie from automysqlbackup etc):

(
echo "SET AUTOCOMMIT=0;"
echo "SET FOREIGN_KEY_CHECKS=0;"
cat databasedump.sql
echo "SET FOREIGN_KEY_CHECKS=1;"
echo "COMMIT;"
echo "SET AUTOCOMMIT=1;"
) | mysql --user=username --password=password database
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki