How to Backup MYSQL Databases

REM Export all databases names to file
mysql -h your-server-ip -u user-name -ppassword information_schema --skip-column-names --execute="SHOW DATABASES;" > databases.tmp
echo "Start!"
REM Look over database names

REM Outter loop to get table names

for /F %%A in (databases.tmp) do (
   echo "Exporting table Names for %%A"
   mysql -h your-server-ip -u user-name -ppassword %%A --skip-column-names --execute="SHOW TABLES;" >"%%A_tables.tmp"

   mkdir %%A


#### nested loop to create table name files per table
   for /F %%B in (%%A_tables.tmp) do (
   echo "Exporting data for %%B of %%A"
   mysqldump -h your-server-ip -u user-name -ppassword %%A %%B> "%%A\%%A_%%B.sql"
   )
)

del *.tmp