MySQL:从另一台服务器选择
恐怕我已经知道我的问题的答案,但我还是会问:
当有两个 MySQL DB 服务器时,我可以访问存储在另一台服务器上的数据吗?
换句话说:我能以某种方式做到这一点:
INSERT INTO table (x, y, z)
SELECT x, y, x+y
FROM [otherserver].[database].[table]
答案真的像“不”那么短吗?
I'm afraid that I already know the answer to my question, but I'll ask it anyway:
When there are two MySQL DB servers, can I access data that is stored on the other server?
In other words: Can I somehow do this:
INSERT INTO table (x, y, z)
SELECT x, y, x+y
FROM [otherserver].[database].[table]
Is the answer really as short as "No"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在 MySQL 中设置联合表来完成您想要做的事情。 有一些限制。
http://dev.mysql.com/doc/refman/en /federated-storage-engine.html
http://dev.mysql.com/doc/refman/en/federated -usagenotes.html
You can set up federated tables in MySQL to accomplish what you're trying to do. There are some limitations.
http://dev.mysql.com/doc/refman/en/federated-storage-engine.html
http://dev.mysql.com/doc/refman/en/federated-usagenotes.html
然后像任何其他表一样使用 SELECT、UPDATE、INSERT、DELETE 查询它。
Then query it like any other table with SELECT, UPDATE, INSERT, DELETE.
你也可以这样做。 假设您位于目标框中(您要将表复制到的位置):
这将使用 mysqldump 从远程主机提取数据并将其插入到本地主机中。
You can also do this. Let's say you're in the target box (where you want to copy the tables TO):
This will pull the data from the remote host with mysqldump and insert it into your local host.