MySQL is software that stores data in tables and lets you read and change that data using SQL. Websites use it to keep users, orders and posts. Data analysts use it to answer business questions. It is one of the most widely used databases in the world, and it is free to learn.
This page explains MySQL in simple words, shows how to install it on Windows, and walks you through your first database and table.
What is MySQL in simple words
Think of a college office. There is a cupboard with files. Each file is a register: one for students, one for fees, one for attendance. Each register has rows and columns.
MySQL is that cupboard, run by software. Each register is a table. The language you use to ask the cupboard for data is SQL.
| Word | Simple meaning | Example |
|---|---|---|
| Database | A collection of related tables | college |
| Table | One register with rows and columns | students |
| Row | One record | One student |
| Column | One field of every record | name, city |
| Query | A question or command in SQL | SELECT * FROM students; |
MySQL is a relational database management system (RDBMS). "Relational" means tables can be linked by shared values, such as a student_id that appears in both the students table and the fees table.
Some facts worth knowing:
- MySQL was first released in 1995. Oracle Corporation owns it today.
- The Community Edition is free and open source.
- It runs on Windows, Linux and macOS.
- It is the "M" in the LAMP stack (Linux, Apache, MySQL, PHP), a classic way to host websites.
SQL and MySQL are not the same thing. The SQL vs MySQL page explains the difference in detail.
What you need before installing
- A 64-bit Windows computer. MySQL 8.4 supports only 64-bit Windows.
- Administrator rights on the computer.
- The Microsoft Visual C++ Redistributable. The installer tells you if it is missing.
- About 1 GB of free disk space to be safe.
MySQL installation steps on Windows
These steps follow the official MySQL 8.4 LTS method: an MSI installer, then a tool called MySQL Configurator. Screens can change between versions, so read each one before you click Next.
Step 1: Download the installer. Go to dev.mysql.com/downloads and open MySQL Community Server. Pick the Windows MSI installer for the LTS (long-term support) version. You can skip the Oracle account login by clicking "No thanks, just start my download".
Step 2: Run the MSI.
Double-click the file and follow the wizard. The typical setup installs the server in C:\Program Files\MySQL\MySQL Server 8.4. At the end, keep the option to run MySQL Configurator ticked. The server will not start until it is configured.
Step 3: Choose type and networking. For your own laptop, pick the Development Computer config type. Leave the port as 3306. This is the standard MySQL port.
Step 4: Set the root password.
root is the main admin account. Type a strong password and write it down somewhere safe. You will need it every time you connect. You can also add a normal user here, but it is optional.
Step 5: Windows service. Keep "Configure MySQL Server as a Windows Service" ticked and keep it starting automatically. This means MySQL starts every time Windows starts. The configurator suggests a service name based on the version. Note it down.
Step 6: Apply.
Leave the other pages at their defaults. You can tick the sample databases sakila and world if you want practice data. Click Execute and wait for every step to show a green tick. Then click Finish.
Common mistake: Forgetting the root password. On a practice laptop the quick fix is to uninstall, delete the data folder in
C:\ProgramData\MySQLand install again. That deletes all data, so write the password down the first time.
Connect to MySQL from the command line
The mysql command line client is installed in the server's bin folder. Open Command Prompt and run:
cd "C:\Program Files\MySQL\MySQL Server 8.4\bin"
mysql -u root -p
Type your root password when asked. You will see the mysql> prompt. That means you are connected.
To run mysql from any folder, add the bin folder to your Windows PATH environment variable. Then open a new Command Prompt.
Check your version with:
SELECT VERSION();
Type exit to leave the client.
Optional: MySQL Workbench. Workbench is a free visual tool from the same site. It gives you a query editor, a list of tables and result grids. It is a separate download. Everything on this page works the same in Workbench: type the query and click the lightning icon to run it.
Create your first database and table
Now use MySQL. Every SQL statement ends with a semicolon.
1. Create a database and select it.
CREATE DATABASE college;
USE college;
USE tells MySQL which database the next commands are for.
2. Create a table.
CREATE TABLE students (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50) NOT NULL,
city VARCHAR(30),
marks INT
);
| Part | Meaning |
|---|---|
INT |
Whole number |
VARCHAR(50) |
Text up to 50 characters |
AUTO_INCREMENT |
MySQL fills 1, 2, 3 and so on by itself |
PRIMARY KEY |
Each row's id must be unique and not empty |
NOT NULL |
This column cannot be left empty |
Check the structure with DESCRIBE students;. The CREATE TABLE in SQL lesson covers more data types and constraints.
3. Insert rows.
INSERT INTO students (name, city, marks) VALUES
('Sneha', 'Hyderabad', 88),
('Rahul', 'Warangal', 72),
('Fatima', 'Hyderabad', 91),
('Arjun', 'Vijayawada', 65);
We did not give an id. MySQL fills 1 to 4 because of AUTO_INCREMENT.
4. Read the data.
SELECT * FROM students;
+----+--------+------------+-------+
| id | name | city | marks |
+----+--------+------------+-------+
| 1 | Sneha | Hyderabad | 88 |
| 2 | Rahul | Warangal | 72 |
| 3 | Fatima | Hyderabad | 91 |
| 4 | Arjun | Vijayawada | 65 |
+----+--------+------------+-------+
5. Filter and sort.
SELECT name, marks
FROM students
WHERE city = 'Hyderabad'
ORDER BY marks DESC;
+--------+-------+
| name | marks |
+--------+-------+
| Fatima | 91 |
| Sneha | 88 |
+--------+-------+
6. Update and delete.
UPDATE students SET marks = 75 WHERE id = 2;
DELETE FROM students WHERE id = 4;
Pro tip: Always write the
WHEREpart before you runUPDATEorDELETE. Without it, MySQL changes or removes every row in the table. Run aSELECTwith the sameWHEREfirst to see which rows will change.
Useful MySQL commands for beginners
| Command | What it does |
|---|---|
SHOW DATABASES; |
Lists all databases |
USE college; |
Selects a database |
SHOW TABLES; |
Lists tables in the current database |
DESCRIBE students; |
Shows the columns of a table |
SELECT VERSION(); |
Shows the MySQL version |
DROP TABLE students; |
Deletes a table and all its rows |
exit |
Leaves the mysql client |
SHOW, USE and DESCRIBE are MySQL commands. Other databases have their own ways to do the same thing. The core SELECT, INSERT, UPDATE and DELETE work almost the same everywhere. See the SQL commands guide for the full list grouped as DDL, DML and more.
What to learn next
- Read what is SQL to understand the language itself.
- Practise
SELECTwithWHERE,ORDER BYandLIMIT. - Learn
GROUP BY, joins and subqueries. - Design two linked tables, such as students and fees, using a foreign key.
If you are choosing between databases, MySQL vs PostgreSQL explains how the two popular free options differ. When you can write queries without help, test yourself with the SQL interview questions for freshers.
Frequently Asked Questions
Is MySQL free to use?
What is the difference between SQL and MySQL?
What is the default port of MySQL?
I forgot the MySQL root password. What do I do?
Do I need MySQL Workbench?
Want to Build Your Career in Data Analytics with AI?
Join CodeBegun and train with working industry engineers — See the Data Analytics course in Hyderabad

