title: Automatic MySQL backup using batch File
body: <p>I am trying to make <strong>auto backup of mysql database</strong>; searched many links got many references but didn't even find a single option that work for me(accept paid software). Finally I am trying this <a href="https://www.devside.net/wamp-server/automatically-backup-mysql-databases-on-windows-wamp" rel="nofollow noreferrer">link</a>.</p>
  
  <p>Now I have <strong>batch script</strong>(below given) and I edit it according to my credentials but it is creating empty SQL file. I don't know why? I am new to MYSQL and it's auto backup mechanism very poor.</p>
  
  <pre><code>@ECHO OFF
  
  set TIMESTAMP=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
  
  REM Export all databases into file C:\path\backup\databases.[year][month][day].sql
  "C:\wamp\bin\mysql\mysql5.6.12\bin\mysqldump.exe" –-user=root –-password=xyz --all-databases --result-file="D:\dbbackup.%TIMESTAMP%.sql"
  
  REM Change working directory to the location of the DB dump file.
  C:
  CD \path-to\backup\
  
  REM Compress DB dump file into CAB file (use "EXPAND file.cab" to decompress).
  MAKECAB "databases.%TIMESTAMP%.sql" "databases.%TIMESTAMP%.sql.cab"
  
  REM Delete uncompressed DB dump file.
  DEL /q /f "databases.%TIMESTAMP%.sql"
  </code></pre>
  
  <p>I run this batch file it create backup but empty sql file.</p>