Wednesday, July 18, 2018
mysql auto backup daily
centOS
1) config backup server
whm ------ search backup -------------- click backup configuration
2) download backup file
cpanel --------------- file section ------------- backup
https://www.inmotionhosting.com/support/website/backup-and-restore/backup-your-database-in-cpanel
=======================================================================
*************************** windows server 2012 *********************************
https://www.devside.net/wamp-server/automatically-backup-mysql-databases-on-windows-wamp
create a .bat file,
this will use time stamp create a dump file, then zip it to CAB file.
use 7-zip to extract it.
windows task scheduler, to schedule this batch file.
---------------------------------------------
@ECHO OFF
set TIMESTAMP=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
REM Export all databases into file C:\backup\mysql\databases.[year][month][day].sql
"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqldump.exe" --all-databases --result-file="C:\backup\mysql\databases.%TIMESTAMP%.sql" --user=root --password=aaaa1111
REM Change working directory to the location of the DB dump file.
C:
CD C:\backup\mysql
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"
-------------------------------------------------------------------
===============
dump all db
mysqldump.exe --user=root --password=aaaa1111 --host=localhost --port=3306 --result-file="C:\backup\mysql\mysqldump.sql" --default-character-set=utf8 --single-transaction=TRUE --all-databases
===============
dump named db
mysqldump.exe --user=root --password=aaaa1111 --host=localhost --port=3306 --result-file="C:\Users\engcid299\OneDrive\current_PC_backup\mysql\dump.sql" --default-character-set=utf8 --single-transaction=TRUE --databases "cleargov1" "glassgov1" "arcgis_viewer"
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment