Mysql – Source control makes sure the code is never lost, how to make sure the users/orders database is never lost

database-designMySQL

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?

Best 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.