0

Does anybody have an example on how to dump all databases uses mysql dump? And possible all a new file for each DB?

I'm using the follow command:

mysqldump -u root -p pw --all-databases > backup.sql;

It's returning with "You have an error in your SQL sytax";

Thanks!

  • currently, mysqldump does not have an option for a separate *.sql file. you can achieve this, with a batch file, having to put some easy code on a batch file. here's a question that explains this process with some practical examples>> [link](http://stackoverflow.com/questions/9472804/batch-file-for-mysqldump-to-backup-each-database-into-a-separate-file) – Pablo Contreras Dec 17 '14 at 02:18

1 Answers1

0

There is an error in your command, it should be no space after -p,
like

mysqldump -u root -ppw --all-databases > backup.sql;

I not sure how many database you have, usually you can do this :-

mysqldump -u root -ppw db_a > db_a.sql;
mysqldump -u root -ppw db_b > db_b.sql;
...
... for all the databases
ajreal
  • 46,720
  • 11
  • 89
  • 119