Source control makes sure my code is never lost, how do I make sure my users/orders database is never lost?

Posted on

Question :

Everyone is recommending the use of git, automated tests, continuous integration, automated deployment and so on, to reduce human error during all stages of web development.
I have yet to come across a clean, automated way of doing this for databases.
Currently, I’m using the Symfony2 framework for PHP and doctrine to create/manage my users database in MySQL. How do I make sure that my users & orders databases will always remain safely backed up without manual intervention?

Answer :

You can dump databases with a cron job, but your database schema should be under version control just like all the other code.

For MySQL, see mysqldump.

Copy or move the backup files to a safe place. (Or to two different safe places.) The database server is not a safe place.

Leave a Reply

Your email address will not be published. Required fields are marked *