0

I have a small (<10GB) database backing an Intranet WSGI website. In the Apache logs I frequently see timeout errors whose timestamp coincides with the daily backup cron job. I'm running incremental backup on /var/lib/mysql using duplicity. My questions:

1) Is this a coincidence, or is it possible to have interference here?

2) Is there a better way to do a database backup?

Host is RHEL7

2
  • Database backup must be performed using database backup instruments, not filesystem backup ones. Documentation (use mysqldump, for example).
    – Akina
    Commented Jan 21, 2020 at 7:44
  • OTOH, it is OK to backup the filesystem if mysql is stopped.
    – Rick James
    Commented Jan 26, 2020 at 20:16

1 Answer 1

1

You should use mysqldump, for example if you want to backup all databases:

# mysqldump --all-databases > dump.sql

You might need to add options for username, password, etc. Read the online documentation on mysqldump (MySQL Reference Manual) for other options.

If you just copy the database files while the server is running, it is very likely that you will be unable to restore databases using those files.

1
  • Thanks. I've been unsing mysqldump, but it didn't seem efficient as backup tool. Also I will look into mariabackup, for some reason I hadn't found that yet.
    – musbur
    Commented Jan 22, 2020 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.