我有这个代码用于备份mysql bat文件,这是代码。
@echo off
echo Starting Backup of Mysql Database on server
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set dt=%%c-%%a-%%b)
For /f "tokens=1-4 delims=:." %%a in ('echo %time%') do (set tm=%%a%%b%%c%%d)
set bkupfilename=%1 %dt% %tm%.sql
echo Backing up to file: %bkupfilename%
mysqldump -p 3306 -h 192.168.0.1 -u root -p 123456
bayanat>C:\mysql_daily_backups\"bayanat%bkupfilename%"
答案 0 :(得分:0)
端口必须是-P not -p( - port = port_num,-P port_num),-p和密码之间没有空格
<-- snip -->
mysqldump -alv -P 3306 -h 192.168.0.1 -u root -p123456
bayanat 2> C:\mysql_daily_backups\output.log >C:\mysql_daily_backups\"bayanat%bkupfilename%"