GitHub - EnterpriseDB/mysql_fdw: PostgreSQL foreign data wrapper for MySQL
https://github.com/EnterpriseDB/mysql_fdw.git
下载mysql_fdw源码编译:
make USE_PGXS=1
将so control sql等文件copy到pg对应的目录下
lib share/extension位置取决于安装方式,源码编译和yum安装具体目录不同,注意区别
create extension mysql_fdw; --安装插件mysql_fdw
create server mysql_server_built foreign data wrapper mysql_fdw options (host '13.6.6.6', port '3306');
--创建用户映射
create user mapping for public server mysql_server_built options (username 'root', password '123');
--创建外部表指向mysql的tmp表
create foreign table tt1(id int,c1 text) server mysql_server_built options(dbname 'built',table_name 'tt1');