title: Backup database to file with CakePHP or normal PHP
body: <p>I wrote a script to dump my database into a file but it involved querying the database, storing the results in an array and then using <code>fopen</code> and <code>fwrite</code> to write the file. </p>
  
  <p>Since my database is very large it tries to allocate too much memory and fails. </p>
  
  <p>Does anyone know a simple way to backup my database to an SQL file the same as a MySQL export would do, that won't use too much memory?</p>