What is MySQL?

MySQL is one of the most popular open source relational databases in the world. It owes this popularity to its widespread use in ecommerce websites, social media, and applications, including Drupal, Joomla, Magento, and WordPress. It is also an essential part of the widely used Linux-Apache-MySQL-PHP/Perl/Python (LAMP) web application stack, which powers many popular applications, websites, and services. It is ranked the second most popular database in the world by DB-Engines.

Learn how Google Cloud’s managed relational database Cloud SQL for MySQL can help you reduce operational costs and improve efficiencies.

MySQL defined

MySQL is an open source relational database management system. As with other relational databases, MySQL stores data in tables made up of rows and columns. Users can define, manipulate, control, and query data using Structured Query Language, more commonly known as SQL. Since MySQL is open source, it includes numerous features developed in close cooperation with users for more than 25 years.

MySQL software is open source

MySQL is open source, which means that it is available to use free of cost under the GNU General Public License terms. This also means that anyone is free to modify the source code of the software for their own use. This has led to the forking of MySQL to other variants of the database like MariaDB and Percona Server for MySQL MySQL are also available under other licenses for commercial use.

Relational database

MySQL belongs to a category of databases, called relational database management systems (RDBMS). A relational database is a collection of information that organizes data in predefined relationships where data is stored in one or more tables (or "relations") of columns and rows, making it easy to see and understand how different data structures relate to each other. Relationships are a logical connection between different tables, established on the basis of interaction among these tables.

History

MySQL was created as an extension to the commercial programming language, SQL, which was based on the relational model described in Edgar F. Codd’s paper. The Swedish company MySQL AB, founded by David Axmark, Allan Larsson, and Michael Widenius, developed and released MySQL in 1995. The name "MySQL" is a combination of Michael Wildenius' daughter’s name "My" and “SQL,” which refers to Structure Query Language (SQL). Sun Microsystems acquired MySQL AB in 2008. MySQL is currently under the ownership of Oracle Corporation after the acquisition of Sun Microsystems in 2010.

MySQL was originally developed in C and C++ programming languages and has enjoyed lots of popularity for its many versions over the years because of its availability on many open source and proprietary operating systems. The latest version of the database, MySQL version 8.0, was released in 2018.

Forks

The MySQL project was forked many times over the years due to various reasons with some forks not even existing anymore. Of the remaining forked projects, the most popular ones are MariaDB and Percona Server for MySQL. MariaDB was forked by the original founders of MySQL to make sure that MySQL remains open source after commercialization concerns arose from the Oracle acquisition. Percona Server for MySQL is another open source distribution of MySQL which intends to maintain close compatibility with MySQL. Learn more about versions of MySQL and the complete ecosystem around MySQL.

User interface

MySQL can be accessed either through a graphical user interface (GUI) or command line interface tools. 

Graphical user interface (GUI)

GUIs provide an integrated environment consisting of buttons and interaction widgets making the querying and development of applications a visual experience, as opposed to using text-based commands in a command line interface. There are many MySQL GUIs developed by both the MySQL open source project and third-party integrators. One of the more popular ones is MySQL Workbench, which is also open source and was developed by MySQL AB. Some other well known GUIs are phpMyAdmin, an administration tool popular for web application development, and HeidiSQL, an open source administration tool that can be used for administering other databases besides MySQL.

Command line

MySQL can also be accessed through command line tools. These tools, also referred to as MySQL utilities, are shipped with MySQL distribution and are invoked with text commands either in the MySQL shell or other command line interface tools like the Percona Toolkit.

Deploying MySQL

A user can deploy MySQL manually on their own physical machine, using the open source code, or it can be deployed by downloading one of the packaged distributions. MySQL is most commonly installed on a single instance or machine with vertical scaling as the primary way to improve performance. However, MySQL can be set up in a replicated configuration with one primary node and many secondary nodes, which have the ability to be promoted to primary in case of instance failure.

Another increasingly popular way of hosting MySQL is through cloud service providers (CSPs). There are a couple of ways of deploying MySQL in a cloud service provider's environment. One is by installing MySQL directly on a virtual machine and self managing it. The other is through the use of managed offerings of cloud service providers that make the administration of MySQL a lot easier by taking care of many operational aspects of managing MySQL. Google Cloud offers a managed service in the form of Cloud SQL. Cloud SQL for MySQL is a fully managed database service that helps you set up, maintain, manage, and administer your MySQL relational databases on Google Cloud, reducing the toil on database administrators and helping organizations innovate by offering Value-Add Services around security, high availability, and observability. Learn how to set up a Cloud SQL instance of MySQL from this article on best practices of setting up a Cloud SQL for MySQL instance. Migrating to Cloud SQL for MySQL from on-premises MySQL or from another database in a cloud service provider is made very easy and simple with many tools and options available to the user.

To understand the advantages of and differences between the fully managed offering of Cloud SQL for MySQL and self-managed MySQL, visit the article on MySQL hosting options.

Benefits of MySQL

MySQL is fast, reliable, scalable, and easy to use. MySQL can run comfortably on a desktop or laptop, alongside your other applications, web servers, and so on, requiring little or no attention. If you dedicate an entire machine to MySQL, you can adjust the settings to take advantage of all the memory, CPU power, and I/O capacity available. MySQL can also scale up to clusters of machines, networked together.

There are many other advantages to using MySQL to manage and store your data, including:

High availability

High availability (HA) in MySQL refers to the database engine's capability to operate for an extended time without failures. HA in MySQL can be quite complex to set up and depends on each user's particular availability requirements and how they are deploying MySQL. To set up HA in MySQL, users would need to worry about data replication, failure detection, failover and failback mechanisms, and redirecting the database traffic to the secondary instance after a failover. Cloud SQL for MySQL makes high availability a simple and easy process. Learn more about high availability for MySQL on Google Compute Engine or the fully managed, high availability experience of Cloud SQL for MySQL.

Security

MySQL security considerations can span a vast range of factors. Some important ones are around data protection, such as protecting data from corruption using data redundancy mechanisms and general security processes like passwords and privileges, access control, and network security. Learn more about security in Cloud SQL for MySQL, Google Cloud’s fully managed MySQL offering.

Backup and restore

MySQL supports the backup and recovery of data using multiple mechanisms, including third-party tools. Some ways to backup and restore MySQL are through the mysqldump utility, incremental backups using binary logs, and using replication. Cloud SQL for MySQL offers its own backup and restore features allowing for automated or on-demand backups. 

Flexibility

It’s easy to add, update, or delete tables and relationships and make other changes to data whenever you need to, without changing the overall database structure or impacting existing applications.

Ease of use

It’s easy to run complex queries using SQL, empowering novice users to interact intuitively with the database.

Performance

Performance optimization is a critical aspect of managing any database. MySQL makes it easy to develop highly performant applications by providing many features and tuning options. Learn more about such features through this article on performance optimization tips for MySQL. This other article on query tuning provides specific best practices for performance as well.

MySQL supports ACID (atomicity, consistency, isolation, durability) properties that ensure data validity regardless of errors, failures, or other potential mishaps.

Use cases

Due to its versatility, MySQL can be used for many different use cases. Below are some you can explore further.

Web applications

MySQL is an essential part of many web applications built today using the open source LAMP stack. LAMP includes Linux as the operating system, Apache as the web server, MySQL as the database, and PHP, Python, or Perl as the programming language. LAMP helps developers build dynamic web applications that require retrieving up-to-date information from a database like MySQL. Information can include user accounts, user details, product names, customer records, sales, and more. Using SQL, users can easily access and manipulate information stored in the database. To learn more, see LAMP and how to use it for building web applications.

Online transaction processing

Many applications today require a database, such as MySQL, that can quickly handle a large number of database transactions from a large number of people. OLTP databases like MySQL are the foundation for many everyday web transactions, including financial transactions, travel reservations, record keeping, and much more. To support online transaction processing use cases, MySQL adheres to ACID principles, support for XML and JSON, stored procedures, clustering, and partitioning. It also provides the option to select from various storage engines, which gives you the flexibility to integrate data from a variety of table types.

Ecommerce

MySQL is a popular database for ecommerce applications that require managing users, consumer information, financial data, and analyzing trends to prevent fraudulent activities. A relational database like MySQL can be used to organize information into tables (products, customers, orders) and additional tables can be added as needed. Some of the world's largest organizations like Airbnb, Uber, Netflix, Booking.com, Spotify, and eBay use MySQL to power their ecommerce applications. MySQL can also be deployed in a hybrid deployment to fully support ecommerce use cases. MySQL can be used as the relational database for structured data and a non-relational database for unstructured data, such as product details or marketing information. 

SaaS applications

SaaS applications are typically 24/7 operations, so they require minimal downtime, security, and the ability to scale as needs change. MySQL has emerged as a popular database option for building SaaS applications as it is easy to deploy, manage, and scale. Since it is open source, developers can get started quickly without having to pay licensing fees for proprietary software. The MySQL global community is active and has contributed to plugins that provide additional capabilities.

Content management

MySQL is a popular database choice for content management systems (CMS) like WordPress and Drupal. CMSs store posts, pages, images, comments, categories, tags, custom fields, users, and other settings in the MySQL database. Since CMSs often have thousands or even millions of accounts each day, MySQL can handle large tables and multiple queries at once. As your audience grows, MySQL can scale vertically or horizontally to meet your business needs. 

Social media

An important aspect of social media applications is the need for connections among various data stores like users, groups, and comments. This sort of use case leads to preference of relational databases for social media applications with MySQL being a top choice. Some notable examples are Twitter, Pinterest, and LinkedIn.

Ready to give MySQL a try?

Google Cloud offers a fully managed offering of MySQL, Cloud SQL for MySQL

Learn how Cloud SQL for MySQL helps you innovate. View documentation

Take the next step

Start building on Google Cloud with $300 in free credits and 20+ always free products.

Google Cloud
  • ‪English‬
  • ‪Deutsch‬
  • ‪Español‬
  • ‪Español (Latinoamérica)‬
  • ‪Français‬
  • ‪Indonesia‬
  • ‪Italiano‬
  • ‪Português (Brasil)‬
  • ‪简体中文‬
  • ‪繁體中文‬
  • ‪日本語‬
  • ‪한국어‬
Console
Google Cloud