HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlModerate

Backup via mysqldump. Is this safe to do on production or will it crash the server?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thistheproductionmysqldumpwillviasafeservercrashbackup

Problem

I want to run this command during the time in which the production server is running the application:

mysqldump -u sbp -p databasename_production > databasename_development_copy.sql


Is this safe to do while production is running or no?

In short, development would be a lot easier if I had a copy of production data. Is this safe to do?

I'm doing this in digitalocean fwiw.

Solution

Unless you add --single-transaction and you're using innodb tables this could block writes to the database for the period of the dump. So use --single-transaction (and innodb).

The only risk is if you are using a DO instance that is far too small and causes the mysql server or mysqldump (less likely) to run out of memory.

If you start gaining swap usage during the dump you can kill off the mysqldump process.

These few cases aside, its pretty safe.

Context

StackExchange Database Administrators Q#219966, answer score: 10

Revisions (0)

No revisions yet.