SQL Installation & Setup

11/22/2025

SQL installation and setup guide for MySQL on Windows, macOS, Linux

Go Back

SQL Installation & Setup – A Complete Beginner-Friendly Guide

Before you can start learning SQL queries or building database-driven applications, you need to install SQL and set up a working database environment. This guide will walk you through everything required to install, configure, and start using SQL on your system.

This SEO-friendly tutorial covers:

  • What you need before installation

  • Installing MySQL (most popular SQL database)

  • Setting up MySQL Workbench / phpMyAdmin

  • Basic configuration

  • Verifying installation

  • Beginners’ first SQL commands


SQL installation and setup guide for MySQL on Windows, macOS, Linux

🔹 What You Need Before Installing SQL

Most SQL tutorials use MySQL because it is:

  • Free

  • Widely used

  • Beginner-friendly

  • Works with PHP, Node.js, Python, Java, and more

You can install SQL on:

  • Windows

  • macOS

  • Linux (Ubuntu / Debian / CentOS)


🔸 Step 1: Download MySQL Server

Go to the official MySQL website:

https://dev.mysql.com/downloads/

Download the appropriate installer for your OS.

✔ For Windows

Download MySQL Installer (Community Edition).

✔ For macOS

Download DMG Archive version.

✔ For Linux

Use package manager (shown below).


🔸 Step 2: Install MySQL Server

🟦 Windows Installation

  1. Run the MySQL Installer

  2. Choose Developer Default

  3. Install MySQL Server + Workbench

  4. Set root password

  5. Complete installation

🟩 macOS Installation

  1. Open .dmg file

  2. Run the installer wizard

  3. Set a root password

  4. Finish installation

🟥 Linux Installation (Ubuntu)

sudo apt update
sudo apt install mysql-server

Secure the installation:

sudo mysql_secure_installation

🔸 Step 3: Install MySQL Workbench (GUI Tool)

MySQL Workbench helps you:

  • Run SQL queries

  • Create tables visually

  • View database structures

  • Manage connections

Download from:

https://dev.mysql.com/downloads/workbench/

🔸 Step 4: Start MySQL Service

Windows

MySQL runs automatically after installation.

macOS

brew services start mysql

Linux

sudo systemctl start mysql
sudo systemctl enable mysql

Check the status:

sudo systemctl status mysql

🔸 Step 5: Log in to MySQL

Command Line Login

mysql -u root -p

Enter your root password.

You are now inside the MySQL CLI.

Workbench Login

  • Open MySQL Workbench

  • Click Local Instance

  • Enter password

  • Start running queries


🔸 Step 6: Create Your First Database

CREATE DATABASE tutorial_db;

Select the database:

USE tutorial_db;

🔸 Step 7: Create Your First SQL Table

CREATE TABLE users (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(100),
  email VARCHAR(100)
);

🔸 Step 8: Insert Data into the Table

INSERT INTO users (name, email)
VALUES ('Shubham', '[email protected]');

🔸 Step 9: Retrieve Data (Your First Query)

SELECT * FROM users;

🔹 Troubleshooting Common Installation Issues

❗ MySQL Service Not Starting

  • Check port 3306 availability

  • Restart the server

  • Reinstall the MySQL service

❗ Forgot Root Password

Use:

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password';

❗ Workbench Crashing

  • Update Workbench version

  • Increase system RAM


🔹 Summary

In this SQL installation and setup guide, you learned:

  • How to install MySQL on Windows, macOS, and Linux

  • How to set up MySQL Workbench

  • How to log in and start MySQL server

  • How to create your first database and table

  • How to run basic SQL queries

You are now ready to start learning SQL commands, joins, filtering, and more advanced concepts.