Thesqldump –no-data and –single-transaction

MySQLmysql-5.0

I am using mysqldump to take snapshots of the structure of a MySQL 5.0.77 database. I don't want the data, so I use the –no-data option.

If I use –single-transaction am I needlessly locking tables?

Best Answer

If you only want a dump of the schema there is really no point in using the --single-transaction option. This option is more useful towards obtaining consistent data from transactional tables. In fact, while using this option, the dump is still vulnerable to being corrupt if any of the following statements are executed: ALTER TABLE, CREATE TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE.

You can read more on the description for this option on the MySQL Documentation for 5.0.