MySQL (/ˌmaɪˌɛsˌkjuːˈɛl/)[6] is anopen-sourcerelational database management system (RDBMS).[6][7] Its name is a combination of "My", the name of co-founderMichael Widenius' daughter My,[1] and "SQL", the acronym forStructured Query Language. Arelational database organizes data into one or more data tables in which data may be related to each other; these relations help structure the data. SQL is a language that programmers use to create, modify and extract data from the relational database, as well as control user access to the database. In addition to relational databases and SQL, an RDBMS like MySQL works with anoperating system to implement a relational database in a computer's storage system, manages users, allows for network access and facilitates testing database integrity and creation of backups.
The MySQL server software itself and the client libraries usedual-licensing distribution. They are offered underGPL version 2, or a proprietary license.[19]
Support can be obtained from the official manual.[20] Free support additionally is available in different IRC channels and forums. Oracle offers paid support via its MySQL Enterprise products. They differ in the scope of services and in price. Additionally, a number of third party organisations exist to provide support and services.
MySQL has received positive reviews, and reviewers noticed it "performs extremely well in the average case" and that the "developer interfaces are there, and the documentation (not to mention feedback in the real world via Web sites and the like) is very, very good".[21] It has also been tested to be a "fast, stable and true multi-user, multi-threaded SQL database server".[22]
David Axmark (left) and Michael "Monty" Widenius, founders of MySQL AB (2003).
MySQL was created by a Swedish company,MySQL AB, founded bySwedesDavid Axmark and Allan Larsson, along withFinnMichael "Monty" Widenius.Original development of MySQL by Widenius and Axmark began in 1994.[23] The first version of MySQL appeared on 23 May 1995. It was initially created for personal usage frommSQL based on the low-level languageISAM, which the creators considered too slow and inflexible. They created a newSQL interface, while keeping the sameAPI as mSQL. By keeping the API consistent with the mSQL system, many developers were able to use MySQL instead of the (proprietarily licensed) mSQL antecedent.[24]
Additional milestones in MySQL development included:
First internal release on 23 May 1995
Version 3.19: End of 1996, from www.tcx.se
Version 3.20: January 1997
Windows version was released on 8 January 1998 for Windows 95 and NT
Version 3.21: production release 1998, from www.mysql.com
Version 3.22: alpha, beta from 1998
Version 3.23: beta from June 2000, production release 22 January 2001[25]
Version 4.0: beta from August 2002, production release March 2003 (unions).
Version 4.1: beta from June 2004, production release October 2004 (R-trees andB-trees, subqueries, prepared statements).
Version 5.0: beta from March 2005, production release October 2005 (cursors, stored procedures, triggers, views,XA transactions).
The developer of the Federated Storage Engine states that "The Federated Storage Engine is aproof-of-concept storage engine",[26] but the main distributions of MySQL version 5.0 included it and turned it on by default. Documentation of some of the short-comings appears in "MySQL Federated Tables: The Missing Manual".[27]
Version 5.1: production release 27 November 2008 (event scheduler,partitioning, plugin API, row-based replication,server log tables)
Version 5.1 contained 20 known crashing and wrong result bugs in addition to the 35 present in version 5.0(almost all fixed as of release 5.1.51).[29]
MySQL 5.1 and 6.0-alpha showed poor performance when used fordata warehousing – partly due to its inability to utilize multiple CPU cores for processing a single query.[30]
Oracle acquired Sun Microsystems on 27 January 2010.[31][32][33]
The day Oracle announced the purchase of Sun, Michael "Monty" Widenius forked MySQL, launchingMariaDB, and took a swath of MySQL developers with him.[34]
Geir Høydalsvik, current Senior Software Development Director for MySQL at Oracle in 2018
MySQL Server 5.5 was generally available (as of December 2010[update]). Enhancements and features include:
The default storage engine isInnoDB, which supports transactions and referential integrity constraints.
SIGNAL and RESIGNAL statement in compliance with the SQL standard.
Support for supplementary Unicode character sets utf16, utf32, and utf8mb4.[a]
New options for user-defined partitioning.
MySQL Server 6.0.11-alpha was announced[37] on 22 May 2009 as the last release of the 6.0 line. Future MySQL Server development uses a New Release Model. Features developed for 6.0 are being incorporated into future releases.
The general availability of MySQL 5.6 was announced in February 2013.[38] New features included performance improvements to thequery optimizer, higher transactional throughput in InnoDB, newNoSQL-style memcached APIs, improvements to partitioning for querying and managing very large tables,TIMESTAMP column type that correctly stores milliseconds, improvements to replication, and better performance monitoring by expanding the data available through thePERFORMANCE_SCHEMA.[39] The InnoDB storage engine also included support for full-text search and improved group commit performance.
The general availability of MySQL 5.7 was announced in October 2015.[40] As of MySQL 5.7.8, August 2015,[41] MySQL supports a nativeJSON data type defined by RFC 7159.[42][43]
MySQL Server 8.0 was announced in April 2018,[44] including NoSQL Document Store, atomic and crash safe DDL sentences andJSON Extended syntax, new functions, such as JSON table functions, improved sorting, and partial updates. Previous MySQL Server 8.0.0-dmr (Milestone Release) was announced 12 September 2016.[45]
LTS =Long-Term Support (every two years) IR =Innovation Release (every three months)
Work on version 6 stopped after the Sun Microsystems acquisition. TheMySQL Cluster product uses version 7. The decision was made to jump to version 8 as the next major version number.[81]
On 15 June 2001, NuSphere sued MySQL AB, TcX DataKonsult AB and its original authors Michael ("Monty") Widenius and David Axmark in U.S. District Court in Boston for "breach of contract,tortious interference with third party contracts and relationships and unfair competition".[82][83]
In 2002, MySQL AB sued Progress NuSphere forcopyright andtrademark infringement inUnited States district court. NuSphere had allegedly violated MySQL AB's copyright by linking MySQL's GPL'ed code with NuSphere Gemini table without being in compliance with the license.[84] After a preliminary hearing beforeJudge Patti Saris on 27 February 2002, the parties entered settlement talks and eventually settled.[85] After the hearing,FSF commented that "Judge Saris made clear that she sees the GNU GPL to be an enforceable and binding license."[86]
In October 2005, Oracle Corporation acquiredInnobase OY, theFinnish company that developed the third-party InnoDB storage engine that allows MySQL to provide such functionality as transactions andforeign keys. After the acquisition, an Oraclepress release mentioned that the contracts that make the company's software available toMySQL AB would be due for renewal (and presumably renegotiation) some time in 2006.[87] During the MySQL Users Conference in April 2006, MySQL AB issued a press release that confirmed that MySQL AB and Innobase OY agreed to a "multi-year" extension of their licensing agreement.[88]
In February 2006, Oracle Corporation acquiredSleepycat Software,[89] makers of theBerkeley DB, a database engine providing the basis for another MySQL storage engine. This had little effect, as Berkeley DB was not widely used, and was dropped (due to lack of use) in MySQL 5.1.12, a pre-GA release of MySQL 5.1 released in October 2006.[90]
In January 2008, Sun Microsystems bought MySQL AB for $1 billion.[91]
In April 2009, Oracle Corporation entered into an agreement to purchase Sun Microsystems,[92] then owners of MySQL copyright and trademark. Sun's board of directors unanimously approved the deal. It was also approved by Sun's shareholders, and by the U.S. government on 20 August 2009.[93] On 14 December 2009, Oracle pledged to continue to enhance MySQL[94] as it had done for the previous four years.
A movement against Oracle's acquisition of MySQL AB, to "Save MySQL"[95] from Oracle was started by one of the MySQL AB founders,Monty Widenius. The petition of 50,000+ developers and users called upon the European Commission to block approval of the acquisition. At the same time, some Free Softwareopinion leaders (includingPamela Jones ofGroklaw, Jan Wildeboer andCarlo Piana, who also acted as co-counsel in the merger regulation procedure) advocated for the unconditional approval of the merger.[96][97][98] As part of the negotiations with the European Commission, Oracle committed that MySQL server will continue until at least 2015 to use the dual-licensing strategy long used by MySQL AB, with proprietary and GPL versions available. The antitrust of the EU had been "pressuring it to divest MySQL as a condition for approval of the merger". But theUS Department of Justice, at the request of Oracle, pressured the EU to approve the merger unconditionally.[99] The European Commission eventually unconditionally approved Oracle's acquisition of MySQL AB on 21 January 2010.[100]
In January 2010, before Oracle's acquisition of MySQL AB, Monty Widenius started a GPL-onlyfork,MariaDB. MariaDB is based on the same code base as MySQL server 5.5 and aims to maintain compatibility with Oracle-provided versions.[101]
MySQL is offered under two different editions: theopen source MySQL Community Server[102] and the proprietaryEnterprise Server.[103] MySQL Enterprise Server is differentiated by a series of proprietary extensions which install as server plugins, but otherwise shares the version numbering system and is built from the same code base.
Major features as available in MySQL 5.6:
A broad subset ofANSI SQL 99, as well as extensions
Virtual Synchronous: Self managed groups of MySQL servers with multi master support can be done using: Galera Cluster[113] or the built in Group Replication plugin[114]
Commit grouping, gathering multiple transactions from multiple connections together to increase the number of commits per second.
The developers release minor updates of the MySQL Server approximately every two months. The sources can be obtained from MySQL's website or from MySQL'sGitHub repository, both under the GPL license.
When using some storage engines other than the default of InnoDB, MySQL does not comply with the fullSQL standard for some of the implemented functionality, including foreign key references.[115] Check constraints are parsed but ignored by all storage engines before MySQL version 8.0.15.[116][117]
Up until MySQL 5.7, triggers are limited to one per action / timing, meaning that at most one trigger can be defined to be executed after anINSERT operation, and one beforeINSERT on the same table.[118]No triggers can be defined on views.[118]
Before MySQL 8.0.28, inbuilt functions likeUNIX_TIMESTAMP() would return0 after 03:14:07UTC on19 January 2038.[119] In 2017, an attempt to solve the problem was submitted, but was not used for the final solution that was shipped in 2022.[120][121][122]
MySQL can be built and installed manually from source code, but it is more commonly installed from a binary package unless special customizations are required. On mostLinux distributions, thepackage management system can download and install MySQL with minimal effort, though further configuration is often required to adjust security and optimization settings.
LAMP software bundle, displayed here together withSquid.
Though MySQL began as a low-end alternative to more powerful proprietary databases, it has gradually evolved to support higher-scale needs as well. It is still most commonly used in small to medium scale single-server deployments, either as a component in aLAMP-based web application or as a standalone database server. Much of MySQL's appeal originates in its relative simplicity and ease of use, which is enabled by an ecosystem of open source tools such asphpMyAdmin.In the medium range, MySQL can be scaled by deploying it on more powerful hardware, such as a multi-processor server with gigabytes of memory.
There are, however, limits to how far performance can scale on a single server ('scaling up'), so on larger scales, multi-server MySQL ('scaling out') deployments are required to provide improved performance and reliability. A typical high-end configuration can include a powerful source database (formerly known as master database[123]) which handles data write operations and isreplicated to multiple replicas (formerly known as slaves[124]) that handle all read operations.[125] The source server continually pushes binlog events to connected replicas so in the event of failure a replica can be promoted to become the new source, minimizing downtime. Further improvements in performance can be achieved by caching the results from database queries in memory usingmemcached, or breaking down a database into smaller chunks calledshards which can be spread across a number of distributed server clusters.[126]
Oracle MySQL offers a high availability solution with a mix of tools including the MySQL router and the MySQL shell. They are based on Group Replication, open source tools.[127]
MariaDB offers a similar offer in terms of products.[128]
In this implementation, cloud users can upload amachine image of their own with MySQL installed, or use a ready-made machine image with an optimized installation of MySQL on it, such as the one provided by Amazon EC2.[130]
Some cloud platforms offer MySQL "as a service". In this configuration, application owners do not have to install and maintain the MySQL database on their own. Instead, the database service provider takes responsibility for installing and maintaining the database, and application owners pay according to their usage.[131] Notable cloud-based MySQL services are theAmazon Relational Database Service; Oracle MySQL HeatWave Database Service,[132] Azure Database for MySQL,[133]Rackspace;HP Converged Cloud;Heroku andJelastic. In this model the database service provider takes responsibility for maintaining the host and database.
Agraphical user interface (GUI) is a type of interface that allows users to interact with electronic devices or programs through graphical icons and visual indicators such as secondary notation, as opposed to text-based interfaces, typed command labels or text navigation.
Third-party proprietary and free graphical administration applications (or "front ends") are available that integrate with MySQL and enable users to work with database structure and data visually.
MySQL Workbench is the integrated environment for MySQL. It was developed by MySQL AB, and enables users to graphically administer MySQL databases and visually design database structures.
MySQL Workbench is available in three editions, the regularfree and open sourceCommunity Edition which may be downloaded from the MySQL website, and the proprietaryStandard Edition which extends and improves the feature set of the Community Edition, and the MySQL Cluster CGE.[134][135]
Acommand-line interface is a means of interacting with a computer program where the user issues commands to the program by typing in successive lines of text (command lines). MySQL ships with manycommand line tools, from which the main interface is themysql client.[136][137]
MySQL Utilities is a set of utilities designed to perform common maintenance and administrative tasks. Originally included as part of the MySQL Workbench, the utilities are a stand-alone download available from Oracle.
Percona Toolkit is a cross-platform toolkit for MySQL, developed inPerl.[138] Percona Toolkit can be used to prove replication is working correctly, fix corrupted data, automate repetitive tasks, and speed up servers. Percona Toolkit is included with severalLinux distributions such asCentOS andDebian, and packages are available forFedora andUbuntu as well. Percona Toolkit was originally developed as Maatkit, but as of late 2011, Maatkit is no longer developed.
MySQL shell is a tool for interactive use and administration of the MySQL database. It supports JavaScript, Python or SQL modes and it can be used for administration and access purposes.[139]
In addition, anODBC interface calledMySQL Connector/ODBC allows additional programming languages that support the ODBC interface to communicate with a MySQL database, such asASP orColdFusion. TheHTSQL – URL-based query method also ships with a MySQL adapter, allowing direct interaction between a MySQL database and any web client via structured URLs. Other drivers exists for languages likePython[143] orNode.js.[144]
MariaDB is a community-developed fork of the MySQL relational database management system intended to remain free under the GNU GPL. The fork has been led by the original developers of MySQL, who forked it due to concerns over its acquisition by Oracle.[34]
Drizzle was a free software/open source relational database management system (DBMS) that was forked from the now-defunct 6.0 development branch of the MySQL DBMS.[147] Like MySQL, Drizzle had aclient/server architecture and usesSQL as its primarycommand language. Drizzle was distributed under version 2 and 3 of theGNU General Public License (GPL) with portions, including the protocol drivers andreplication messaging under theBSD license.
WebScaleSQL was a software branch of MySQL 5.6, and was announced on 27 March 2014 by Facebook, Google, LinkedIn and Twitter as a joint effort to provide a centralized development structure for extending MySQL with new features specific to its large-scale deployments, such as building large replicated databases running on server farms. Thus, WebScaleSQL opened a path toward deduplicating the efforts each company had been putting into maintaining its own branch of MySQL, and toward bringing together more developers. By combining the efforts of these companies and incorporating various changes and new features into MySQL, WebScaleSQL aimed at supporting the deployment of MySQL in large-scale environments.[148][149] The project's source code is licensed under version 2 of the GNU General Public License, and is hosted onGitHub.[150][151]
The OurDelta distribution, created by the Australian company Open Query (later acquired by Catalyst IT Australia), had two versions: 5.0, which was based on MySQL, and 5.1, which was based on MariaDB. It included patches developed by Open Query and by other notable members of the MySQL community including Jeremy Cole and Google. Once the patches were incorporated into the MariaDB mainline, OurDelta's objectives were achieved and OurDelta passed on its build and packaging toolchain to Monty Program (now MariaDB Plc).[152]
^ab"History of MySQL".MySQL 8.0 Reference Manual. Oracle Corporation. Retrieved3 April 2020.MySQL is named after co-founder Monty Widenius's daughter, My.
^ab"What is MySQL?".MySQL 8.0 Reference Manual. Oracle Corporation. Retrieved3 April 2020.The official way to pronounce "MySQL" is "My Ess Que Ell" (not "my sequel"), but we do not mind if you pronounce it as "my sequel" or in some other localized way.
^Sobel, Jason (21 December 2007)."Keeping Up".The Facebook Blog. Facebook. Archived fromthe original on 18 June 2009. Retrieved18 June 2009.[...] Facebook's data is stored in MySQL database servers [...]
^Matsunobu, Yoshinori (31 August 2016)."MyRocks: A space- and write-optimized MySQL database".Facebook Engineering.Archived from the original on 7 March 2020. Retrieved7 March 2020.At Facebook we use MySQL to manage many petabytes of data, along with the InnoDB storage engine [...]
^Elliott-McCrea, Kellan (8 February 2010)."Using, Abusing and Scaling MySQL at Flickr".code.flickr.com. Retrieved3 April 2020.[...] at Flickr, MySQL is our hammer, and we use it for nearly everything. It's our federated data store, our key-value store, and our document store.
^"Manual:MySQL".www.mediawiki.org. MediaWiki, The Free Wiki Engine. Retrieved3 April 2020.The MySQL and MariaDB database engines are the most commonly-used database backends for MediaWiki.
^Hashemi, Mazdak (19 January 2017)."The Infrastructure Behind Twitter: Scale".blog.twitter.com. Retrieved3 April 2020.SQL: This includes MySQL, PostgreSQL and Vertica. MySQL/PosgreSQL are used where we need strong consistency [...]
^"Commercial License for OEMs, ISVs and VARs".www.mysql.com. July 2010. Retrieved3 April 2020.Oracle provides its MySQL database server [...] under a dual license model [...] Oracle makes its MySQL database server [...] available under the GPLv2 [...]
^"Changes in MySQL 5.1.12".MySQL 5.1 Reference Manual. MySQL AB. 24 October 2006. Archived fromthe original on 20 October 2012. Retrieved16 September 2012.
^"MariaDB versus MySQL - Compatibility".MariaDB KnowledgeBase. Retrieved3 April 2020.MariaDB versions function as a "drop-in replacement" for the equivalent MySQL version, with some limitations.
^"MySQL Community Edition".www.mysql.com. Retrieved3 April 2020.MySQL Community Edition is the freely downloadable version [...]. It is available under the GPL license [...]