According to the MySQL 5.0 Certification Study Guide, Chapter 32 Section 32.3.4, Pages 456,457 describe the Conditions for Binary Portability which bring out the following:
There are two major ways based on storage engine to move individual tables.
For the given example we will suppose the following:
If mydb.mytable uses the MyISAM storage engine, the table will physically be manifested as three separate files
The .frm contains the table structure
These files are used interdependently to represent the table from a logical standpoint in mysql. Since these file have no further logical association attach to it, migrating a table from one DB server to another. You can even to this from a Windows server to a Linux Server or a MacOS. Of course, you could shutdown mysql and copy the 3 table files. You could run the following:
in one ssh session to hold table as read only and hold the lock for 24 hours. One second later, perform the copy in another ssh session. Then kill the mysql session with the 24 hour lock. You need not wait 24 hours.
Based on the aforementioned quote from the Certification book, there are many factors that govern how to backup a specific InnoDB table. For sake of simplicity, clarity, and brevity, simply perform a mysqldump of the desired table using the --single-transaction parameters to have perfect point-in-time dump of the table. No need to cncern yourself with InnoDB semantics if you just want one table. You can reload that dumpfile to any MySQL server of your choose.
Since two questions were merged here (jcolebrand): EDIT
If you are more than willing to live with some slow DB performance, you can perform a series of rsyncs from the old server (ServerA) to the new server (ServerB) even while mysql is still running on ServerA.
Step 01) install the same version of mysql on ServerB that ServerA has
Step 02) On ServerA, run
Step 04) Repeat Step 03 until an rsync takes less than 1 minute
Step 06) Perform one more rsync
Give it a Try !!!
You can create a replication slave like this. Just remember to have server-id explcitly set in the master /etc/my.cnf and a different number for server-id in the slave /etc/my.cnf
How do I copy a database from one database to another in MySQL?
We need to follow these steps to copy a database to another database:.
First, use the CREATE DATABASE statement to create a new database..
Second, store the data to an SQL file. ... .
Third, export all the database objects along with its data to copy using the mysqldump tool and then import this file into the new database..
How do I copy a database from one database to another?
On either the source or destination SQL Server instance, launch the Copy Database Wizard in SQL Server Management Studio from Object Explorer and expand Databases..
Move. Move the database to the destination server..
Copy. Copy the database to the destination server..
Source. ... .
Status. ... .
How do I copy and paste in MySQL?
First you start by selecting the window with the command line. This can be done by alt + tab . Then when the command line windows is active you can paste the content of your clipboard with: alt + space Then go trough the menu with e and then p .
Can I copy MySQL data directory to another server?
You have to shut down mysql server (which is not good, if it's a production server) You have to make sure the permission of data (mysql) directory is same as the previous one. You will have to monitor the mysql_error log while starting the second server.