How to Connect two databases on two different servers using php

后端 未结 2 1545
日久生厌
日久生厌 2021-01-29 04:37

In MySQL, I have two different databases -- let\'s call them A and B.

Database A resides on server server1, while database B resides on server server2.

Both serv

2条回答
  •  执念已碎
    2021-01-29 05:20

    You can make two separate MySQL connections in PHP, do two queries to the two tables, and then work with the results in PHP.

    Another option, since the servers are physically close, is to setup the one or both servers to replicate the needed database/tables to each other. You can look here for more on MySQL replication: http://dev.mysql.com/doc/refman/5.6/en/replication.html

提交回复
热议问题