According to the announcement, around $US800 million cash will be paid in exchange for MySQL stock and some $US200 million in options will be taken on by Sun.
Millions of websites are built using the LAMP stack - and MySQL is the M in that acronym, with the others being Linux, Apache and PHP/Perl.
MySQL chief executive Marten Mickos will join the Sun executive leadership team after the deal is finalised.
The move will bring Sun up against Oracle, the world's largest database company, but will certainly improve Sun's standing with the open source community.
The idea of buying an open source database has been floating around at Sun for some time; nearly three years ago, then chief executive Scott McNealy was reported by News.com as raising the idea during a meeting of financial analysts.
The same report also said that Jonathan Schwartz, then president, and the current chief executive, told an interviewer that Sun was looking at database software as one way of extending its footprint into the open source realm.
Sun already supports the other well-known open source database, PostgreSQL on its Solaris operating system. And many companies run Oracle on Solaris.
This means that every big IT company has a major open source offering - Microsoft is the only odd man out.
In his blog, Schwartz wrote : "Until now, no platform vendor has assembled all the core elements of a completely open source operating system for the internet. No company has been able to deliver a comprehensive alternative to the leading proprietary OS.
"With this acquisition, we will have done just that - positioned Sun at the center (sic) of the web, as the definitive provider of high performance platforms for the web economy."
HOW TOP MANAGERS MOTIVATE, ENERGISE EMPLOYEESDownload an in-depth guide to managing a healthy, motivated and energetic workforce without breaking the bank.
A professional journalist with decades of experience, Sam for nine years used DOS and then Windows, which led him to start experimenting with GNU/Linux in 1998. Since then he has written widely about the use of both free and open source software, and the people behind the code. His personal blog is titled Irregular Expression.