Category: General
Backup All MySQL Databases and Output To Separate Files
Run this script from a bat file, update the paths as required.
//--- Begin Batch File ---// :: Creates a backup of all databases in MySQL and puts them in separate .sql files. :: By Jon Lucas. :: Name of the database user set dbuser=root :: Password for the database user set dbpass=xxxxx :: Switch to the data directory to enumerate the folders pushd "C:Program FilesMySQLMySQL Server 5.0data" echo "hello" :: Loop through the data structure in the data dir to get the database names FOR /D %%F IN (*) DO ( "C:Program FilesMySQLMySQL Server 5.0binmysqldump.exe" --user=%dbuser% --password=%dbpass% --databases %%F > "C:Program FilesMySQLMySQL Server 5.0backup%%F.sql" )
MySQL