SQLBasicsbeginner

What Is MySQL? How to Install and Use It

MySQL explained simply, how to install it on Windows step by step, and how to create your first database and table.

Published
TL;DR – Quick Answer

MySQL is a free, open source relational database management system that stores data in tables and runs SQL queries. On Windows, download the MySQL Community Server MSI installer from dev.mysql.com, run it, then use MySQL Configurator to set a root password and start the server. After that, connect with mysql -u root -p and create your first database.

On This Page

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\MySQL and 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 WHERE part before you run UPDATE or DELETE. Without it, MySQL changes or removes every row in the table. Run a SELECT with the same WHERE first 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

  1. Read what is SQL to understand the language itself.
  2. Practise SELECT with WHERE, ORDER BY and LIMIT.
  3. Learn GROUP BY, joins and subqueries.
  4. 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?
MySQL Community Edition is free and open source under the GPL licence. Oracle also sells commercial editions with extra tools and support. Students can learn everything they need on the Community Edition.
What is the difference between SQL and MySQL?
SQL is the language you write. MySQL is the software that stores the data and runs your SQL. Other systems such as PostgreSQL and Oracle also understand SQL.
What is the default port of MySQL?
MySQL listens on port 3306 by default. The X Protocol, used by MySQL Shell, uses port 33060. You can change both during configuration.
I forgot the MySQL root password. What do I do?
On a practice machine, the simplest fix is often to uninstall, delete the data folder and install again, which removes all data. The MySQL reference manual also has a section on resetting the root password without reinstalling.
Do I need MySQL Workbench?
No. The mysql command line client is enough to learn. Workbench is a free, separate download that gives you a visual editor, which many beginners find comfortable.

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

Apply for Demo Class →
Siva Prasad Galaba
Founder, CodeBegun · Staff Engineer

Founder of CodeBegun. 15+ years building Java systems at companies like Crunchyroll. Teaches Java, Spring Boot and system design the way the industry actually works, and mentors students through projects, mock interviews and placement preparation.

Technically reviewed by CodeBegun Technical TeamLast reviewed 4 December 2026 LinkedIn
Chat with us