Open main menu

Mysqldump

Revision as of 11:41, 26 November 2014 by Freephile (talk | contribs) (Created page with "quick recipe on using mysqldump == Backup == <source lang="bash"> DB=wiki backupdir="$HOME/backups"; if [ ! -d "$backupdir" ]; then mkdir -p $backupdir; fi backup="$backupd...")

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)

quick recipe on using mysqldump

Backup

DB=wiki
backupdir="$HOME/backups";
if [ ! -d "$backupdir" ]; then
  mkdir -p $backupdir;
fi
backup="$backupdir/dump-$(hostname)-$DB.sql";
/usr/bin/mysqldump $DB > $backup;
ls -al $backup;

Restore

mysql $DB < $backup