Reputation: 766
I have two MySQL databases DB1 and DB2, DB1 is on Online server, and DB2 is on local machine(localhost), Now i want to insert some data into DB2's table named db2_table from DB1's table named db1_table using MySQL QUERY. So it is possible or not?
Upvotes: 2
Views: 567
Reputation: 1235
if you are on the same server you can do something like
INSERT INTO DB2.db2_table (col1, col2, ..., colN) SELECT col1, col2 FROM DB1.db1_table WHERE ...
but being on different servers you can not insert data in this way... the simplest way I can think of, is to dump data from the source db (with phpmyadmin, for instance) and import it into the target db.
Upvotes: 1