Mysqldump
Jump to navigation
Jump to search
quick recipe on using mysqldump
Backup[edit | edit source]
DB=wiki
backupdir="$HOME/backups";
if [ ! -d "$backupdir" ]; then
mkdir -p $backupdir;
fi
backup="$backupdir/dump-$(date +%F).$(hostname)-$DB.sql";
/usr/bin/mysqldump $DB > $backup;
ls -al $backup;
Restore[edit | edit source]
mysql $DB < $backup