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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replicating tables across databases 1

Status
Not open for further replies.

jbeetz1

Programmer
Nov 28, 2000
60
US
I'm looking for advise in setting this up.

I have two databases (db1 & db2) on the same server. I need to replicate only two tables from db1 into db2 on a daily bases. In fact, if possible, I only need a subset of the data that resides in the tables though replicating the entire table is not a problem.

Any advise would help.

Thanks
Jerry
 
I think that as long as the use has access to both databases it should be as easy as

Code:
mysql> use db2;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> create table test as select * from db2.table_name;
Query OK, 703 rows affected (0.12 sec)
Records: 703  Duplicates: 0  Warnings: 0

mysql>

-----------------------------------------
I cannot be bought. Find leasing information at
 
There are many ways to read data from one database into another. You can just use refer to db1 in any select query, or you could create a view. That way, you always use the live situation without any need to replicate. Mind you, the two databases should be on the same server instance to be able to do that (you can run more than one server instance on a physical server).

If the databases are on different server instances, you could define a federated table.

+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top