I am looking for mysql database backup script to backup each database into separate files windows and exclude system database like mysql, information schema.

ex: db1, db2 db1_date_time.sql , db2_date_time.sql

2 Answers 2


I have some sample posts from the past on running mysqldumps in Windows and creating .BAT files for them to execute

Here are other old posts on dumping mysqldumps into specific databases

I hope these help. Have a good day !!!


I have a Bash script backup-mysql-databases.sh for Linux that does exactly what is required here. The same workflow should be easy to convert for Windows.

  mysql -N -B -e "SHOW DATABASES;" \
    | grep -E -v "$ExcludeDatabases"

for db in $databases; do
  mysqldump --databases "$db"
  1. List all databases with mysql -N -B -e "SHOW DATABASES;"
  2. Remove the databases you would like to exclude from the list.
  3. Iterate over the resulting list, e.g., with FOR /F, running mysqldump --databases "$db".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.