SQL Installation & Setup

11/22/2025
All Articles

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

SQL Installation & Setup

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


๐Ÿ”น 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', 'shubham@example.com');

๐Ÿ”ธ 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.

Article