Is MySQL Actually Free? (And when you need a Commercial License)
Date: 2024-09-28 | create | tech | mysql | postgres | databases |
I recently wrote why you should probably just use Postgres for your next webapp. I listed several reasons why I believe Postgres is often a better choice than MySQL including performance, reliability, and flexibility through its ecosystem of plugins.
I also briefly mentioned that MySQL is owned by Oracle which has a spotty track record for licensing arbitration. I've gotten some questions and push back on this so here I wanted to explore this a bit further to add some clarity.
In this post we'll talk about the history of MySQL and Oracle, in which cases you can use MySQL for free, and whether you should care ab this or not.
Disclaimer: I am not a lawyer, just a random guy on the internet that likes to write ab things. This is not legal / business / systems advice, just my opinion based on my understanding of things. It's very possible I'm flat out wrong. So pls do not sue me.
MySQL and Oracle
MySQL is the second most popular database technology according to Stack Overflow's 2024 dev survey. Postgres comes in first with 48.7% usage, MySQL at 40.3%, and SQLite with 33.1%.
Oracle acquired MySQL in 2010 and currently runs it under a dual licensing contract which we'll talk ab in a minute. At the same time one of the creators of MySQL (Monty Widenius) started MariaDB as an open source only version (though it also has commercial versions available).
Can you use MySQL for Free?
The answer is - it depends.
MySQL is open source under GPL (General Public License) BUT there also exists commercial licenses for uses that don't abide by GPL (usually distributing software w/o also being GPL open source). These commercial licenses come in various flavors and the idea is one license allows you to use MySQL on one computer:
Server: is defined as the computer on which the programs are installed. A Server license allows you to use the licensed program on a single specified computer.
I'd also like to call out that these licenses are surprisingly expensive - the cost shown here seeming to be 1 computer for 1 year:
- Standard Edition: $2k+
- Enterprise Edition: $5k+
- Cluster Carrier Grade Edition: $10k+
Okay so when can you use MySQL for free and when do you need to purchase one of these licenses?
Using MySQL as a database for your webapp - Free
You can use MySQL as a database for your webapp for free because you are not distributing MySQL yourself, you're just using it.
This is probably the most common usecase of MySQL so if you're doing this you should be good. This falls squarely in GPL fair use (and really is the whole point of open source) so as long as MySQL remains inside your own infra and you don't distribute it it should be free.
Distributing MySQL with your application - Depends
This is where things get a bit more tricky.
Usecases of this are likely:
- Native desktop apps - using MySQL locally for storage
- Mobile Apps - using MySQL locally for storage
- IoT / on-prem SaaS - Installing MySQL alongside your software that gets distributed to a customer's infra
- Managed Databases? - Unclear but it seems like you're providing this to others (distributing) so probably is at risk for falling under this usecase
Whether this requires a commercial license or not seems to depend on the license you distribute your code under:
- If your system is GPL-licensed open source - does not need a license
- If your system is any other license (including closed source) - you do need a license
So this seems to mean that if you're distributing a system that includes MySQL as part of its installation / function and it's not open sourced - then you need a license.
Should you care about these licensing requirements?
Generally it seems for most webapp usecases you should be good - MySQL is released under GPL so you can use it yourself (as the end user) pretty freely.
Where you need to be a bit careful is if you have a usecase where you're going to be distributing MySQL itself to other end users. Again this will usually be on-prem B2B SaaS or native / mobile apps but there's probably some gray area around this stuff. Even if you're distributing your stuff for free, if the code itself is not open source then you could be at risk.
If you are doing this latter usecase you might want to consider some alternatives that provide MySQL-like features without the scary licenses:
- MariaDB (although it looks to follow the same MySQL commercial license)
- Percona server seems a bit more lenient
- SQLite - Arguably much better for the embedded system usecases
- Postgres - if we're doing big db, might as well use the "best" db
In the end if Oracle never finds out you're misusing the license then I suppose this doesn't matter. But I personally wouldn't test it, Oracle is (in)famously litigious.
- Since 2019, Oracle has flip-flopped on Java's commercial licenses, currently requiring a paid license to get security updates
- And yes, they seem to be coming after orgs using Java - often using Java downloads to trace orgs using it
- This 2021 post lists Oracle Licensing Litigation from 2021 including:
- Coming after customers for not enough licenses of Oracle DB
- Not having the correct license for Oracle DB
- Mentions some potentially concerning licensing rules: "Even companies that have not contracted directly with Oracle are not immune to lawsuits brought by Oracle to enforce their copyrights."
Next
So should you use MySQL for your application? I think it's a decent choice so if that's what you want to use go for it. Just be careful you're not accidentally distributing MySQL along with it.
Personally I find all this legal licensing stuff pretty confusing / annoying / scary and feel there are better options out there so I prefer to just use Postgres. But to each their own.
If you liked this post you might also like:
Want more like this?
The best / easiest way to support my work is by subscribing for future updates and sharing with your network.