PostgreSQL's dblink module allows for SQL statements to be written that execute other SQL statements against a remote PostgreSQL database.
PostgreSQL的dblink模块允许编写SQL语句,对远程PostgreSQL数据库执行其他SQL语句。
Is there an equivalent to PostgreSQL's dblink for MySQL?
有没有相当于PostgreSQL的MySQL的dblink?
3 个解决方案
#1
Not exactly.
There is, however the FEDERATED
storage engine (available since 5.0.3), which can be used in certain situations to emulate this behaviour. It is, (put very simply) a VIEW
for a remote table.
但是,FEDERATED存储引擎(自5.0.3起可用)可以在某些情况下用于模拟此行为。它(非常简单地说)是远程表的VIEW。
There is an in-depth explanation, along with examples on its MySQL manual page(s).
有一个深入的解释,以及MySQL手册页上的示例。
#2
You might want to look into MySQL Proxy. This doesn't match the architecture of dblink, but you can probably solve a similar set of problems that you would use dblink to solve.
您可能想要查看MySQL代理。这与dblink的体系结构不匹配,但您可以解决使用dblink解决的类似问题集。
#3
No. This is not possible with MySQL. The closest you can come is to use replication to replicate the tables you need from the "remote" database down to the slave you are querying on. See the documentation for more details.
不可以。这对MySQL来说是不可能的。您最接近的是使用复制将您需要的表从“远程”数据库复制到您要查询的从属服务器。有关详细信息,请参阅文档。
#1
Not exactly.
There is, however the FEDERATED
storage engine (available since 5.0.3), which can be used in certain situations to emulate this behaviour. It is, (put very simply) a VIEW
for a remote table.
但是,FEDERATED存储引擎(自5.0.3起可用)可以在某些情况下用于模拟此行为。它(非常简单地说)是远程表的VIEW。
There is an in-depth explanation, along with examples on its MySQL manual page(s).
有一个深入的解释,以及MySQL手册页上的示例。
#2
You might want to look into MySQL Proxy. This doesn't match the architecture of dblink, but you can probably solve a similar set of problems that you would use dblink to solve.
您可能想要查看MySQL代理。这与dblink的体系结构不匹配,但您可以解决使用dblink解决的类似问题集。
#3
No. This is not possible with MySQL. The closest you can come is to use replication to replicate the tables you need from the "remote" database down to the slave you are querying on. See the documentation for more details.
不可以。这对MySQL来说是不可能的。您最接近的是使用复制将您需要的表从“远程”数据库复制到您要查询的从属服务器。有关详细信息,请参阅文档。