What's the Best Practice to backup database periodically?

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
manfred1984
Posts: 5
Joined: Thu Jun 02, 2011 5:38 am

What's the Best Practice to backup database periodically?

Post by manfred1984 »

Hello there,

I am evaluating this program to be our knowledge base system and i had to say it's pretty good!!

Now I get a new requirement which is how can I backup the data periodically in phpMyfaq??

I notice there is a handy tool in the admin page that I can backup the data and logs manually and restore it afterwards.

But is there any recommendation or insight on how to do it automatically and periodically ??

I searched in the form and some topics mentioned mysqldump +crontab, is it the best way to do it?

*In fact, I have tried to use mysqldump but failed to restore the database in this way*

backup:
mysqldump --user=root -p mydb > /backup/mydb.sql
restore:
mysql --user=root -p mydb < /backup/mydb.sql

Any ideas would be highly appreciated... Thanks indeed in advance!
jason102178
Posts: 200
Joined: Tue Nov 02, 2010 9:08 am
Location: United States-Ohio
Contact:

Re: What's the Best Practice to backup database periodically

Post by jason102178 »

Yes mysqldump would be the preferred method for most.... But the backup in the Admin would prolly be the easiest and quickest......unfortunately there is no way to set up within phpMyFaq to set up to automatically and periodically back up database.... it has to be done manually within phpmyfaq.... But i guess it also could depend on the Enviroment....


You can always go to propsal on the forum to propose new features for future releases viewforum.php?f=4

The Lead Developer Thorsten might be able to offer more insight on this subject, as he is a very busy person so it might take some time for him to respond, thats why i thought i would send a quick message...
phpMyFAQ Quality Assurance / Forum Moderator
Amazon.com Wishlist
rybal06
Posts: 9
Joined: Wed Mar 09, 2011 5:45 pm

Re: What's the Best Practice to backup database periodically

Post by rybal06 »

I have two ubuntu servers set up as virtual machines hosting my faq instance, as well as 2 other open source cms projects. I have a script which runs nightly to sync the contents and databases between both systems. I have .sh scripts which are scheduled on the production and the failover servers which contain the lines below. I scheduled these to run as cron jobs.

Here is how I am backing up the databases:
mysqldump --all-databases --add-drop-table -u root -pyourpassword >/var/sync/dbsync.sql

Here is how I am restoring them:
mysql -u root -pyourpassword < /var/cp/dbsync.sql

I think the problem you are experiencing is in the syntax, Do not put = after -u, and do not put a space between -p and the password.
nixanwin
Posts: 11
Joined: Mon Aug 02, 2010 9:14 pm

Re: What's the Best Practice to backup database periodically

Post by nixanwin »

You could use mysqldump in a cron job. Or use a backup service such as Tomahawk to automate and send it off-site.
Post Reply