【问题标题】:If possible, how can I query mysql database from a postgresql database?如果可能,如何从 postgresql 数据库查询 mysql 数据库?
【发布时间】:2021-10-13 11:46:46
【问题描述】:

是否可以在 postgresql 数据库中只编写一个查询,也可以从 mysql 服务器获取数据?使用 postgresql 数据库的 dblink_connect 功能,我能够从另一个 postgresql 数据库而不是 mysql 数据库实现这个目标。使用 mysql 数据库时,它给了我连接被拒绝的错误。

这是我在一个 postgresql 数据库中使用并从另一个 postgresql 数据库获取数据的查询:

create extension dblink;
select * from dblink('dbname=dbaname port=1234 host=123.456.678.321 user=username password=password', 'SELECT name FROM tbl_customer') AS newTable (mname varchar);

【问题讨论】:

  • 这是不可能的。

标签: mysql postgresql amazon-web-services dblink


【解决方案1】:

您需要使用(并安装)外部数据包装器。

mysql_fdw 是一种可能的选择。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-21
    • 1970-01-01
    • 2014-11-29
    • 2021-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多