mysqldump --single-transaction mydb > mydb.sql

Category: Databases & SQL

mysqldump --single-transaction mydb > mydb.sql

Take a consistent snapshot without locking tables

Runs the dump inside one transaction so all tables match a single point in time; it only works for InnoDB tables, which are the default in MySQL 8. Ideal for backing up a live server. Related: --routines --triggers for full coverage.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.