MySQL is an open-source relational database management system we can interact with using Structured Query Language (SQL). A query language is a simple programming language that can help you access, manipulate and manage data in a relational database. We use MySQL to store all the information you need to efficiently run large, complex websites.

MySQL represents the M in LAMP (Linux, Apache, MySQL, PHP/Perl/Python), which is a collection of tools used to build web applications. In order to build a web application, we need an operating system, a web server to hold our web application, a database that stores and allows us to access the data and a programming language to develop our application. 

Since MySQL is a commonly used database management system, it’s supported by various programming languages like Python, PHP and JavaScript, hence we can run it on any platform or operating system.

MySQL is used by many of the world’s most powerful web applications like Uber, Netflix, Slack, Twitter, Shopify and Airbnb.

Related Reading From Sara A. MetwalliSQL vs. NoSQL: Which One Should You Choose?


MySQL and SQL: What’s the Difference?

MySQL is a database management system; it’s a way we can store and retrieve data in a structured way so we can use that data in web applications.

The way we can communicate with a database management system is through SQL, Structured Query Language. SQL helps us ask a database management system for specific data through queries, which are basically a set of conditions stating what data we need to retrieve from the database.

Is MySQL Open Source?

Yes, MySQL is open source. MySQL was first introduced as an open-source database management system in 1995 though MySQL AB, a Swedish company. Sun Microsystems acquired the RDBMS in 2008 and Oracle took it over in 2010. Although Oracle owns MySQL, it remains open source for individual developers to use and modify under the GNU General Public License. That said, enterprise companies must obtain a commercial license from Oracle in order to use MySQL at scale.
MySQL Tutorial for Beginners. | Video: Programming With Mosh


How Does MySQL Work?

MySQL is fundamentally based on two main concepts: the relational database and the client-server model. 


1. Relational Database

In a relational database, you store data in separate storage areas, which we call tables. These tables are often related to each other. For example, suppose I have two tables for an airline company, one for the pilots and one for the flights. In that case, they can be connected by a relation, a column in both tables, as in the image below. 

MySQL illustration of a relational database. There are two columns side-by-side. In the column on the left, labelled Pilots, we see Fields: Pilot ID, Name, Rank and Address. In the right-hand column, called Flights, we see Flight ID, Pilot ID, Source and Destination. The is a line connecting Pilot ID in the two columns to illustrate the relation.
Illustration of how a relational database works. | Image: Sara A. Metwalli

In this case, the representation of the relation between the two tables will be the PilotID; in database language we call that a primary key. A primary key is the main connection between two tables in a relational database. 


2. Client-Server Model

MySQL is a management system built on the client-server model. Simply put, the server is where the data is stored and the client is the tool (or approach) you’ll need to use in order to access and retrieve this data.

In the case of MySQL, you can use open-source packages with various programming languages like Python and JavaScript. These packages enable you to use MySQL to handle your data from within your code. We do this using SQL commands that form queries. There are various SQL commands that allow you to perform and retrieve exactly the data you need. For example, if we consider the example above, here are some queries we can use to retrieve different data from the database.

1. Display All the Data in the Pilots Table

FROM Pilots;


2. Display a Specific Column in the Pilots Table

FROM Pilots;

Want to Try SQL for Yourself? Here’s How.Why SQLZoo is the Best Way to Practice SQL


3. Display a Specific Pilot Based on Their ID

FROM Pilots
WHERE PilotID = 10 ;


4. Make a New Table for Meals on a Flight

Where the FlightID is an integer, the name of the meal is within 25 characters and the quantity of each meal is also an integer.

FlightID INT,
MealName VARCHAR(25),
Quantity INT,


5. Add Meals to the MealsInfo Table

INSERT INTO MealsInfo (FlightID,MealName, Quantity)
(1002, Chicken, 46),
(1003, Beef , 28),
(1004, Veg , 39);

All these commands are independent of the programming language you use to build your application. So, whether you use Python, PHPJavaScript or another language, the commands to interact with the database will always be in SQL.

Expert Contributors

Built In’s expert contributor network publishes thoughtful, solutions-oriented stories written by innovative tech professionals. It is the tech industry’s definitive destination for sharing compelling, first-person accounts of problem-solving on the road to innovation.

Learn More

Great Companies Need Great People. That's Where We Come In.

Recruit With Us