HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/bin/mysqlbackup/mysqlbackup.cmd
:: SS, 31/05/2022 MySQL backup of each database

::d:
::cd d:\bin\backup

@echo off

set tmpbakpath=t:\MySQL

echo ============================================================
echo %date% %time% Start

rem --- mysql backup
rem --- use mysql dump command to do dump all the databases
rem (SS,21/3/12) added --routines to make sure functions and procedures are also backed up
rem NB. the --opt options does the following --add-drop-table --add-locks --create-options --disable-keys --extended-insert --lock-tables --quick --set-charset.
rem     all tables in a database are locked before the database is added to the dump

rem mysqldump --opt --user=root --password=oscaris10 --all-databases --routines >d:\backups\mysql_backup.sql

:: (SS,5/5/12) Replaced above with following to individually dump each db
:: go through each folder in mysql datafolder, running the mysqldump command for each database to the d:\backups\mysql folder
:: (SS,22/6/19) added exclusion of redundant database using "if", for it to work I had to move to subroutine section :mysqldump
pushd "D:\MySQL Datafiles\data"
for /d %%f in (*) do ( call :mysqldump %%f ) 
popd

::echo %date% %time% Start of Complete Dump
::#mysqldump --opt --user=root --password=oscaris10 --all-databases --routines >"%tmpbakpath%\mysql_backup.sql
::echo %date% %time% End of Complete Dump


echo ------------------------------------------------------------
echo %date% %time% Finish
echo ============================================================

exit /b

:mysqldump
echo %1
mysqldump.exe --user=root --password=oscaris10 --routines --databases %1 >"%tmpbakpath%\%1.sql"

exit /b

:eof