Skip to content

What is MySQL and what is it used for?

MySQL is a crucial database for any developer to know about. Many of the world's complex organizations use MySQL, such as Boeing, YouTube, and Facebook. In this article, we'll cover why MySQL is the best choice for a relational database due to its versatility, ease of use, and scalability.

What is MySQL?

Before we dive into what MySQL is, we should first discuss what a database is. A database is a storage system for a collection of data. In computing, applications will retrieve and store information in the database. There are several different types of databases: document-oriented, relational, object-oriented — just to name a few.

MySQL is an open-source relational database management system (RDBMS) developed by Oracle. It is the most popular DBMS, used by companies with massive data storage needs such as Facebook, Netflix, Shopify, Uber, and more.

MySQL falls into the relational database category. Relational databases divide, organize, and store data across different tables. For example, a relational database backing a blog may have tables for posts, users, and comments.

These tables are then linked together by defining relationships to one another. In the blog example above, you the table that contains all posts will be comprised of several rows, where each row represents one blog post. The rows will also have columns that contain information about the blog post. For example, each blog post may have a id, title, text, and featured_image` column.

The comment table will also have rows, where each row is a specific comment. To link a comment to the corresponding blog post, there may exist a column named post_id. This makes it possible to associate a specific comment with the correct blog post.

MySQL community and ownership

While MySQL has been around since 1995, it has maintained its preeminent position by continuously meeting the demands of modern applications. Nowadays, developers can even use MySQL for serverless applications using database platforms like PlanetScale.

MySQL is officially owned by Oracle, but MySQL is an open-source database. The source code is free to use and modify under the GNU General Public License (GPL). MySQL works on most operating systems, including macOS, Linux, FreeBDS, and Windows.

The MySQL community is one of the most active open-source software communities and there are many free tutorials and courses to learn MySQL.

Key features of MySQL

MySQL is used to store data in tables that map to objects. Each table has a schema defining what columns each row of the table will have. Developers can reliably store and retrieve many data types, including text, numbers, dates, times, and even JSON.

Interacting with a MySQL database is done with SQL (Structured Query Language). SQL is not a fully fledged programming language. But as a querying language, it offers a straightforward syntax to manage your database through:

  • Creating, updating, and deleting tables.
  • Indexing tables.
  • Retrieving, inserting, updating, and deleting data in tables.
  • Joining data across multiple tables.
  • Running mathematical functions on queried data.
  • Partitioning data.

MySQL’s performance is highly scalable to support even the largest applications. This can be done through optimization methods like indexing tables, upgrading hardware, and horizontal sharding.

Benefits and advantages of MySQL

There aren’t many hurdles to using MySQL because of how much tooling exists to make it plug-and-play with most programming languages and frameworks. Even beginners not familiar with MySQL can use Object-Relationship Mapping (ORM) interfaces to interact with their database with Python, PHP, Ruby, and many other programming languages. MySQL is also compatible with many popular application frameworks, such as Ruby on Rails, Laravel, Django, Spring Boot, and ASP.NET.

Cost doesn’t need to be an obstacle either. MySQL is freely licensed. It’s also lightweight enough to be run on a laptop for personal projects. Alternatively, you can use PlanetScale to avoid the complexity of installing MySQL in the cloud yourself.

Additionally, MySQL’s security features are well-tested. MySQL offers a variety of tools enabling granular control of who has access to what, and numerous plugins exist for auditing and data encryption. With a vast ecosystem of MySQL tooling, there are many options available for tools like GUI-based desktop clients that make it easier to interact with your data.

Common-use cases for MySQL

There are several important benefits from MySQL. They are part of the reason why so many companies have implemented this relational database system. Here’s a look at MySQL is most frequently used for:

  • Web development: MySQL can support any web application use case. It currently backs some of the largest web applications, such as eBay, Dropbox, and Twitter.
  • Storing user information and login credentials: When users register for a site, their information and credentials can be securely stored and retrieved with MySQL. And MySQL is trusted by major financial institutions with sensitive information, including Wells Fargo and JPMorgan Chase.
  • Game development: MySQL is often used by the biggest game development studios, such as Activision Blizzard, as the database back end for various video games.
  • Managing content for websites and blogs: MySQL excels in storing and retrieving content for blogs and websites that need to serve content quickly to keep readers engaged. This could include article texts, comments, article metadata, and lists of email subscribers.
  • E-commerce: E-commerce sites can use MySQL to store product price data and which items are on sale. They can use it for affiliate partner performance data to track how much affiliates are selling.
  • Storing product catalogs and inventory information: Retail or e-commerce businesses managing complex product catalogs and inventory can use MySQL to track which warehouses or stores are low on inventory.
  • Processing and tracking orders and customer data: When a customer buys something, new order and customer records can be inserted into the MySQL database. Subsequent updates to the order’s status can be updated to keep all parties informed about the order.
  • Data analytics: Analysts can create dashboards backed by MySQL queries running mathematical functions on the underlying data right in MySQL. For example, a dashboard could keep executives updated on sales performance hour by hour.
  • Storing and analyzing large datasets: MySQL can house immense amounts of data to be analyzed. For example, a company like Uber can use their historical ride data in MySQL to run queries grouping customer requests by hour to identify when users most commonly request rides.
  • Generating reports: MySQL can efficiently populate reports with insightful data. One example is to imagine a MySQL database housing invoices and payment events for a business. Generating a weekly report showing last week’s paid invoices, as well as which are still outstanding, becomes a simple SQL query.
  • Content management systems (CMS): A CMS needs a place to store content, and MySQL is a popular choice. In fact, WordPress, the world's most popular CMS, uses MySQL.

Considerations when choosing MySQL

Consider your project requirements carefully before choosing MySQL. If you expect your data to be well-structured and you need to run complex queries, MySQL is a great choice. Otherwise, if your data is unstructured or semi-structured, NoSQL may make sense.

Additionally, consider how you would scale your MySQL instance if your application takes off. Will you scale vertically? Or will you scale horizontally using sharding? These are difficult decisions and can be challenging to implement.

Lastly, you need to consider how MySQL will integrate with your existing tech stack. Fortunately, MySQL integrates with a nearly endless list of technologies and frameworks. Nevertheless, do your research to confirm MySQL will play well with your current stack.

To learn more about MySQL, check out PlanetScale’s free MySQL for Developers course.