将一下内容复制保存至bkupmysql.bat 文件中(没有的话创建下),
具体使用方法参考本站链接:https://94ip.com./post/532.html
具体脚本内容如下:
@echo off cls set dbuser=root set dbpass=passwd set DaysAgo=7 set mysqlpath=d:\mysqlbak set mysql=D:\SOFT_PHP_PACKAGE\mysql\bin\mysql.exe set mysqldump=D:\SOFT_PHP_PACKAGE\mysql\bin\mysqldump.exe set dt=%date:~0,4%%date:~5,2%%date:~8,2%0%time:~1,1%%time:~3,2%%time:~6,2% set logfile=d:\bkinfo.log set logfail=d:\bkfail.log if not exist "%mysqlpath%" md "%mysqlpath%" for /f "delims=" %%i in ('mysql -u%dbuser% -p%dbpass% -e"show databases"^|findstr -v "^Database$ ^test$ ^information_schema$ ^performance_schema$ ^mysql$"') do ( %mysqldump% -f -u%dbuser% -p%dbpass% %%i >"%mysqlpath%\%%i-%dt%.sql" 2>>%logfail% If %errorlevel%==0 ( forfiles /p %mysqlpath% /s /m %%i*.* /d -%DaysAgo% /c "cmd /c del /f /q /a @path" echo %date% sucess %%i >>%logfile% ) else ( echo %date% fail %%i >>%logfile% ) )
转载请注明:IT运维空间 » 批处理 » windows下自动备份mysql脚本
继续浏览有关 quotacheck 的文章
发表评论