↑ ↓ select, Enter open, Esc close

Back up a single database consistently as gzip

Adjust the values, the command updates live
user@server
mysqldump --single-transaction --quick -u dbuser -p wp_example | gzip > /var/www/vhosts/example.com/wp_example.sql.gz

Creates an SQL dump of one database and compresses it on the fly. For InnoDB tables, --single-transaction ensures a consistent snapshot without blocking writes, and --quick reads row by row to save memory. The password is prompted interactively.

Note: For MyISAM tables, --single-transaction does not guarantee consistency. Stored procedures and events are only included with --routines and --events.

Also searched as

  • backup mysql database
  • export mysql database to file
  • mysqldump single database gzip

Related one-liners

All in MySQL and MariaDB

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.