mysqldump

From wikieduonline
Jump to navigation Jump to search

mysqldump[1] a backup program.

mysqldump --help
mysqldump --single-transaction
mysqldump --skip-lock-tables

Create backup[edit]

  • mysqldump DB_name > DB_name.sql
    • Compressing from stdin
      • mysqldump DB_name | gzip > DB_name.sql.gz
      • mysqldump DB_name | xz -T0 > DB_name.sql.xz
  • mysqldump -u root -p --all-databases

Restore backup[edit]

create database DB_name;
mysql -u root -p DB_name < /path/to/file/DB_name.sql

Related[edit]

set -o pipefail
mysqldump [...] | restic -r /srv/restic-repo backup --stdin

Activities[edit]

See also[edit]

  • https://linux.die.net/man/1/mysqldump
  • Advertising: