我正在嘗試使自動備份mysql數據庫;搜索了很多鏈接有很多參考,但甚至沒有找到適合我的單一選項(接受付費軟件)。最後我試着用這個link。使用批處理自動執行MySQL備份文件
現在我有批處理腳本(下面給出),我根據我的憑據編輯它,但它正在創建空的SQL文件。我不知道爲什麼?我是MYSQL的新手,它的自動備份機制非常差。
@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"
我運行這個批處理文件,它創建備份,但空的SQL文件。