No history yet

Introduction to MySQL

What Is MySQL?

Think of a massive, perfectly organized library. Every book has a specific spot on a shelf, and there's a catalog system to find any book you need in seconds. That's essentially what MySQL does for data.

MySQL is an open source relational database management system (RDBMS) that’s used to store and manage data.

Let's break that down. A database is a structured collection of data. A database management system is the software that lets you create, manage, and interact with that database. The "R" in RDBMS stands for relational, which is the key to its power. It means data isn't just thrown into a big pile; it's organized into tables, much like spreadsheets. These tables can then be linked, or related, to each other.

Imagine one table for customer information (name, address) and another for orders (product, date). A relational database lets you easily connect a customer to all the orders they've placed.

MySQL uses a language called SQL (Structured Query Language) to manage this data. You use SQL to ask the database for specific information, update records, or add new data. It's the universal language for talking to relational databases.

A Quick History

MySQL wasn't born in a giant tech corporation. It was created in 1995 by a Swedish company called MySQL AB, founded by David Axmark, Allan Larsson, and Michael "Monty" Widenius. They wanted to build a database that was fast, reliable, and, most importantly, accessible to everyone. So, they made it open-source.

Open-source means the original source code is freely available. Anyone can view, modify, and distribute it. This approach fostered a massive community that helped improve and expand MySQL over the years.

Its popularity soared, and in 2008, Sun Microsystems (the creators of Java) acquired MySQL AB. Just two years later, in 2010, Oracle Corporation acquired Sun Microsystems, making MySQL an Oracle product. Despite concerns from the open-source community, Oracle has continued to develop and support both a free community edition and paid commercial editions of MySQL.

Why It Matters for the Web

MySQL is a cornerstone of the modern internet. It’s the "M" in the famous LAMP stack, a popular open-source solution for building and running web applications.

LetterComponentRole
LLinuxThe operating system
AApacheThe web server software
MMySQLThe database
PPHP, Perl, or PythonThe programming language

Almost every dynamic website you use relies on a database. When you log into a social media account, the site checks your username and password against records stored in a database. When you browse an online store, the product names, prices, and images are all pulled from a database. WordPress, the world's most popular content management system, uses MySQL to store everything from blog posts and comments to user accounts and site settings.

Lesson image

MySQL provides the organized, persistent storage that makes these complex web applications possible. Without a database, a website would be just a collection of static pages, unable to remember users or manage content dynamically.

Getting MySQL on Your Machine

To start working with MySQL, you first need to install it. The process differs slightly depending on your operating system.

We'll be installing MySQL Community Server, which is the free, open-source version.

On Windows: The easiest way is to use the MySQL Installer. This is a dedicated application that guides you through the installation and configuration of MySQL Server and other tools like MySQL Workbench (a visual tool for managing your database).

  1. Download the MySQL Installer from the official MySQL website.
  2. Run the installer and follow the setup wizard.
  3. You'll be prompted to choose a setup type. 'Developer Default' is a good choice for getting started.
  4. The installer will handle downloading and installing all the necessary components.
  5. During configuration, you'll be asked to set a password for the 'root' user. This is the main administrator account. Remember this password!

On macOS: While you can use a graphical installer on macOS, many developers prefer using a package manager called Homebrew. It simplifies installing and updating software from the command line.

First, if you don't have Homebrew, open your Terminal and install it. Then, you can install MySQL with a simple command.

# Update Homebrew's package list
brew update

# Install MySQL
brew install mysql

After the installation, Homebrew will give you instructions on how to start the MySQL server.

On Linux: For Linux distributions like Ubuntu or Debian, you can use the built-in package manager, apt.

# Update your package list
sudo apt update

# Install the MySQL server package
sudo apt install mysql-server

After installation, it's a good idea to run the included security script to set a root password and remove insecure default settings.

sudo mysql_secure_installation

This script will walk you through the process step-by-step. Now you're ready to start working with your own local database server.

Quiz Questions 1/5

What does the 'R' in RDBMS stand for?

Quiz Questions 2/5

Which corporation acquired MySQL in 2010 and is its current primary developer?

With MySQL installed, you have a powerful tool at your fingertips, ready to store and manage data for any project you can imagine.