on 3/7/01 6:39 PM, Cindy at [EMAIL PROTECTED] wrote:

> How would I copy ONE table from a database over to another?
> 
> I used this last time:
> 
> mysqldump -h mysql.io.com -u DB1 -p --opt DB1 > !  backup-file.sql
> mysql -h mysql.io.com -u DB2 -p DB2 < backup-file.sql
> 
> But it copies the whole shebang (all tables in DB1).  The situation I
> have now is that I use DB2 (after previously using DB1 up to two weeks
> ago), but this afternoon, I dropped one of the tables by accident.
> Call it Table1.  Table1 is now filled with current entries, but is
> missing all its old entries, which can be found in the copy of Table1
> in DB1.  I would like to *add* (not replace) all the entries in Table1
> of DB1 to Table1 of DB1.
> 
> I'm guessing this would involve using mysql dump to get the copy of
> Table1 out of DB1 and then into DB2 under a new name, and then
> use some command within mysql's command line interface to add the rows
> from the old table to the current one?  Some kind of Merge function?

If they're on the same server, try:

   insert into DB2.table1 select * from DB1.table1

Otherwise, consider selecting INTO OUTFILE on DB1 and then using mysqlimport
or LOAD INFILE to bring it in to DB2.

Geoff


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to