I've got a bunch of MyISAM files (MYD, MYI, FRM) in the mysql directory and newer versions of them in another directory. How can I replace "old" ones with "newer" without stopping the mysql server?
For my answer, let's assume
Here is a bait-and-switch approach
This should create the folder
Step 02) Place the new version of the proddata table into the
CAVEAT : Don't worry about mysql. It will detect the presence of the new table in the
Step 03) Perform a swap of the proddata table between
I recommend that you run these two commands on the same line:
Have fun with it.
Give it a Try !!!
Step 03 uses SQL to perform the swap because it will negotiate when it is safe to move the table. Hence, if there are any queries running against it, the execution of the SQL will wait for all queries to cease before performing the move of the table.
An added benefit of this approach is that the old table is still availble in the
Swap files on the Operating System level.
(credit to Jeff for the lock table)
Don't. Instead, load them into another copy of mysql, and get a dump using mysqldump. Then load that into the running mysql.