- If I write code in PHP or Python that uses GPL MySQL connectors for PHP or Python - which license applies to my code? That of PHP or Python, or GPL?
If my code is released (in source) using one of the of FOSS licenses listed in the MySQL Exception then that license applies. Otherwise the GPL would apply.
- Can I run my PHP or Python code on a server and offer commercial services without the GPL?
Yes, as long as I run my code is a service: for instance Facebook and Google are known to use MySQL on the backend of some of their commercial services.
- Can I bundle my PHP code in an application and distribute it commercially without the GPL?
I can, but then my PHP (or Python) code would be subject to the GPL when it depends at runtime on MySQL. This is the quid-pro-quo to entice you to buy a commercial license. As a side note, if I ever buy a commercial license of MySQL for redistribution, the terms (last I saw them) did prohibit to mix the commercial MySQL with the open source GPL-licensed MySQL, and these are different binaries anyway.
Let's say there is a wrapper for MySQL connector in Python that has been released under Python license (as is allowed by the FOSS exception) - and my code uses this wrapper. Am I not bound by the Python license instead of GPL?
At rest, my source code does not interact nor embed with anything and is not subject to the GPL.
But at runtime, this Python connector is unlikely to have implemented the raw wire protocol for MySQL and likely links with the MySQL GPL-licensed headers and libraries (at least all the Python drivers I know of do): therefore at runtime, I consider that the GPL terms would extend to the Python driver and from there to my application. See this article for a gentle introduction on dependencies.
That said what can I do in this case?
Do not use MySQL and use PostgreSQL, SQLite, etc. This is what I do. Personally I also find PostgreSQL to be a superior technical choice in most cases.
Consider alternative MySQL "implementations" such as MariaDB. MariaDB has furthered the old MySQL LGPL-licensed drivers to bring them up to date with the latest protocol. There used to be also a BSD or MIT-licensed driver called libdrizzle, but I am less clear about its status.
Using the MariaDB driver would replace my proprietary->GPL interaction by a proprietary->LGPL dynamic linking interaction which I and my lawyers may consider OK, though this is a grey area because of the lawsuit-happy Oracle commercial interests being bypassed in this context.