Skip to main content
Added backup tag since mysqldump performs backups
Link
RolandoMySQLDBA
  • 184.3k
  • 33
  • 323
  • 531
Source Link
Pietro
  • 609
  • 3
  • 9
  • 19

Copying a database for testing in a safe way

For testing purposes I have to create a copy of a production MySQL database that cannot be touched.

These are the steps I would follow:

  1. Create a reduced size database backup:

    mysqldump prodDB --single-transaction --where="true limit 20" > test.sql

  2. Create a new test database: testDB

  3. Load the dump file in the new test database:

    mysql testDB < test.sql

Is this procedure correct?
Can I be sure that the original database will not be modified whatsoever?

Thank you!

System: MySQL 5.1 with InnoDB