/ Published in: MySQL
CLI commands for backing up mySQL database
Expand |
Embed | Plain Text
-- dump mySQL database to file: VAR=$(DATE +�%y-%m-%d�); mysqldump -v -uUSERNAME -pPASSWORD -hlocalhost DATABASENAME > /BACKUPDIR/$VAR-DATABASENAME.sql ; -- dump mySQL database to file and then move it: VAR=$(DATE +�%y-%m-%d�); mysqldump -v -uUSERNAME -pPASSWORD -hlocalhost DATABASENAME > /BACKUPDIR/$VAR-DATABASENAME.sql ; mv /BACKUPDIR/DATABASENAME.sql /OTHERBACKUPDIR/$VAR-DATABASENAME.sql ;
Comments
Subscribe to comments
You need to login to post a comment.

apologies for the fuck-up with the date syntax. dunno why this has happened - aren't we all using unicode here?
you can ignore the 'VAR=$(date....) ' and '$VAR' stuff if you want. it's only there to add the backup date to the filename, when it saves the DB dump.