mysqldump

From wikieduonline
Revision as of 06:20, 9 June 2024 by Welcome (talk | contribs)
Jump to navigation Jump to search

mysqldump[1] a backup program.

mysqldump --help
mysqldump --single-transaction

Create backup

  • 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

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

Related

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

Activities

See also

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