3

In regards to:

Remounting MySQL under a new mount point

What would be the best way to backup MySQL data before moving the mount point? Can this be done with MySQL running? Would a simple rsync off to another server work?

Tiffany Walker
  • 6,681
  • 14
  • 56
  • 82

2 Answers2

2

Simple backup with MySQL downtime

  1. Stop MySQL - /etc/init.d/mysql stop
  2. Backup data directory - tar czf /var/backups/mysql-2012-10-25.tar.gz /var/lib/mysql

Backup using XtraBackup

Percona XtraBackup can be used to take online hot (non-blocking) backups of your database.

pkhamre
  • 6,120
  • 3
  • 17
  • 27
  • Anyway to do this without stopping mysql? This is a production system with close to 3GBs worth of MySQL database information. That could be a lot of downtime to tar. – Tiffany Walker Oct 25 '12 at 12:06
  • Yeah, I will edit the answer with an additional solution. – pkhamre Oct 25 '12 at 12:07
  • XtraBackup is non-locking on InnoDB tables but requires a read lock on all tables to do MyISAM. If you have a mix of the two, the lock will only be in place while the MyISAM tables are being backed up. – Ladadadada Oct 25 '12 at 12:41
0

You can also backup your mysql database directory using rsync just add -a option in your command to preserve owner & permission.

rsync -arvz source destination.

user103373
  • 198
  • 6
  • 19