Shows how the GPL-2 MySQL license differs from PostgreSQL’s permissive license and how to stay compliant when integrating both databases.
The MySQL Community Edition ships under GNU GPL-2. Any software that links to the MySQL server or client libraries and is distributed externally must also be released under a GPL-compatible license, unless you purchase a commercial license from Oracle.
PostgreSQL uses a permissive, Berkeley-style license. You can modify, embed, and distribute PostgreSQL in closed-source products without releasing your source code. The GPL-2 attached to MySQL imposes reciprocal obligations that the PostgreSQL license does not.
Running MySQL and PostgreSQL side-by-side is safe. Problems arise only when you statically link MySQL GPL client libraries into proprietary binaries. Accessing a MySQL database from PostgreSQL through a foreign data wrapper (FDW) is considered "mere aggregation" and does not infect your Postgres code with GPL requirements.
Use the mysql_fdw
extension. Because the FDW is licensed under the PostgreSQL License and communicates with MySQL over TCP, your own code remains unaffected by the GPL.
1. Install mysql_fdw
.
2. Create the server, user mapping, and foreign tables (see syntax below).
3. Query MySQL tables from PostgreSQL just like native tables.
Keep MySQL client libraries separate from proprietary binaries, prefer TCP connections over embedded libraries, document external dependencies, and review Oracle’s dual-licensing terms before distribution.
Embedding libmysqlclient in closed-source apps. This triggers GPL obligations—use dynamic linking or REST/FDW calls instead.
Assuming PostgreSQL’s permissive license covers MySQL code. Each component keeps its own license; audit dependencies individually.
No. Networked access via FDWs or drivers is usually considered separate work under the GPL.
Yes, internal use is exempt, but distribution outside your organization triggers GPL requirements.
No. The FDW communicates over TCP, so your code remains independent of the GPL.
Yes, but distribute them under compatible licenses or clearly separate the GPL parts.
Yes, purchasing a commercial license removes GPL obligations for distributed software.