[thelist] MySQL, copy between databases?

Hassan Schroeder hassan at webtuitive.com
Tue Sep 30 17:53:17 CDT 2003


Ken Moore wrote:

 > Is there any way to copy records between databases without exporting and
 > then importing?
 >
 > Example:
 >
 > In database db1, there is a table called db1_table1. In database db2,
 > there is an identical table called db2_table1. I want to copy records
 > from table db1_table1 to db2_table2.

Depends -- is this a one-time deal, or?

For a complete copy to start out with --

CREATE TABLE IF NOT EXISTS db2.table2 SELECT * FROM db1.table1

   /* assuming you have the proper permissions on both DBs */

What you do after that depends on the needs of your application(s) :-)

-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.





More information about the thelist mailing list