Move MySQL database while instance is online
Posted
by
Mike Scott
on Server Fault
See other posts from Server Fault
or by Mike Scott
Published on 2012-02-27T11:06:19Z
Indexed on
2013/06/28
10:23 UTC
Read the original article
Hit count: 358
I have a MySQL instance containing a number of databases, one of which is an archive database (although using the INNODB rather than ARCHIVE storage engine) that is not queried or written to in normal operation.
The data filesystem is filling up and I'd like to move the archive database's data directory to a different filesystem (and then symlink it back, obviously). If there are no SQL statements attempting to query or update the data during the move, can I safely do this while the MySQL instance and the other databases stay online and in use?
I plan to rsync the database directory to the new filesystem, then rename the old one on the original filesystem to something different and create the new symlink. lsof reports that MySQL does have the .ibd files open, so presumably it would have to reopen them.
© Server Fault or respective owner