Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Move a Table? 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
What is the easiest way to move a table from one database to another?
I assume I'll need to copy it somehow, and then delete the source?
 
The complete table? A table is a little set of files, and a database is a directory. Then, move the files!
 
Yes, you can move the files, but if there is any version difference between the two systems, you might have a problem. The best way is to use "mysqldump" to dump the table to a text file, and then pipe the text file into the other database. (This works for a whole database also)


existing system:
mysqldump -u root -p database_name table_name > tablefile.txt

new system:
mysql -u root -p database_name < tablefile.txt
 
OK, the data dump will work for me, but I am guessing there is an easier way for my situation.
I do not own the server, I use a commercial host, so the first reply from Elgis will not work for me (but thanks anyway).

What I have is two databases on the same server: say DB1 and DB2.
TableOfMine is on DB1, and I want to move it to DB2 without a lot of trying to CREATE the right structure, etc. There must be a simple copy facility, I just haven't found it in the documentation.
Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top