mysql - how to add date and time with backupfile name using mysqldump from command prompt and to define the path of backupfile -
im using command backup mysqldump
mysqldump -uroot -ptrackerdb) --alldatabases >test.sql
now want add date-time backup file current date , time e.g test_25july2013_13:00
for add test_date +%y-%m-%d_%h-%m-%s
.sql in file name gives error
'couldn't find table': date +%y-%m-%d_%h-%m-%s`
what i'm doing wrong here?
i'm using that:
linux
mysqldump -u <user> -p <database> | bzip2 -c > <backup>$(date +%y-%m-%d-%h.%m.%s).sql.bz2
windows (googled it, because have been using lin only)
@echo off cls echo date format = %date% echo dd = %date:~0,2% echo mm = %date:~3,2% echo yyyy = %date:~6,4% echo. echo time format = %time% echo hh = %time:~0,2% echo mm = %time:~3,2% echo ss = %time:~6,2% echo. echo timestamp = %date:~6,4%-%date:~3,2%-%date:~0,2%-%time:~0,2%-%time:~3,2%-%time:~6,2% %mysqldir%\mysqldump -u %mysqluser% -p%mysqlpassword% -h %mysqlhost% -p %mysqlport% --databases --routines --verbose gnucash_shockwave > %backupdir%\gnucash_shockwave-%timestamp%.sql
Comments
Post a Comment