SQL Topics
Install MySQL
title: Install MySQL
Before learning SQL, you need a Database Management System (DBMS) to execute SQL queries.
One of the most popular databases is:
MySQLMySQL is:
Open Source
Fast
Reliable
Easy To Learn
Widely UsedUsed by companies such as:
Facebook
Twitter
YouTube
Netflix
UberWhat is MySQL?
MySQL is a Relational Database Management System (RDBMS) used to store, manage, and retrieve data using SQL.
Why Learn MySQL?
Benefits:
Free and Open Source
Easy Installation
Large Community Support
Cross Platform
Industry StandardSystem Requirements
Minimum Requirements:
RAM: 2 GB
Storage: 1 GB Free Space
OS: Windows, Linux, macOS
Internet ConnectionRecommended:
RAM: 4 GB+
SSD Storage
Latest Operating SystemInstalling MySQL on Windows
Step 1: Download MySQL Installer
Visit:
https://dev.mysql.com/downloads/installer/Download:
MySQL Installer for WindowsStep 2: Run Installer
Double-click:
mysql-installer-community.exeStep 3: Choose Setup Type
Available options:
Developer Default
Server Only
Client Only
Full
CustomFor beginners choose:
Developer DefaultThis installs:
MySQL Server
MySQL Workbench
MySQL Shell
Connectors
DocumentationStep 4: Install Required Components
Installer may ask to install:
Install all required dependencies.
Step 5: Configure MySQL Server
Choose:
Standalone MySQL ServerStep 6: Select Configuration Type
Choose:
Development ComputerThis uses fewer system resources.
Step 7: Configure Port
Default MySQL Port:
3306Keep default value.
Step 8: Set Authentication Method
Choose:
Use Strong Password EncryptionRecommended option.
Step 9: Create Root Password
Example:
Root Password:
MyStrongPassword123Important:
Remember This PasswordYou will need it every time you connect to MySQL.
Step 10: Configure Windows Service
Keep default settings:
Service Name: MySQL80
Start At System Startup: EnabledStep 11: Apply Configuration
Click:
ExecuteWait for configuration to complete.
Step 12: Finish Installation
Click:
FinishMySQL is now installed.
Verify MySQL Installation (Windows)
Open Command Prompt:
mysql --versionExpected Output:
mysql Ver 8.x.xConnect to MySQL
Open Command Prompt:
mysql -u root -pEnter password.
Successful connection:
mysql>Installing MySQL on Ubuntu Linux
Update Packages
sudo apt updateInstall MySQL
sudo apt install mysql-serverStart MySQL
sudo systemctl start mysqlEnable Auto Start
sudo systemctl enable mysqlCheck Status
sudo systemctl status mysqlExpected:
active (running)Secure MySQL Installation
Run:
sudo mysql_secure_installationThis helps:
Set Root Password
Remove Anonymous Users
Disable Remote Root Login
Remove Test DatabaseConnect to MySQL (Linux)
sudo mysqlor
mysql -u root -pInstalling MySQL on macOS
Step 1: Download MySQL
Visit:
https://dev.mysql.com/downloads/mysql/Download:
macOS DMG ArchiveStep 2: Run Installer
Open downloaded DMG file.
Step 3: Follow Installation Wizard
Click:
Continue
Continue
InstallStep 4: Set Root Password
Create secure password.
Example:
Root@123Step 5: Complete Installation
Click:
FinishVerify Installation (macOS)
Open Terminal:
mysql --versionMySQL Workbench
During installation you also get:
MySQL WorkbenchWorkbench provides:
Visual Interface
Database Management
Query Editor
Schema Designer
Administration ToolsConnect Using MySQL Workbench
Open:
MySQL WorkbenchCreate connection:
Hostname: localhost
Port: 3306
Username: root
Password: Your PasswordClick:
Test ConnectionFirst MySQL Query
After connecting:
SELECT 'Hello MySQL';Output:
Hello MySQLShow Existing Databases
SHOW DATABASES;Example Output:
information_schema
mysql
performance_schema
sysCreate Your First Database
CREATE DATABASE my_database;Use Database
USE my_database;Verify Current Database
SELECT DATABASE();Output:
my_databaseCommon Installation Problems
MySQL Command Not Found
Problem:
mysql is not recognizedSolution:
Add MySQL bin directory to system PATH.
Example:
C:\Program Files\MySQL\MySQL Server 8.0\binPort 3306 Already In Use
Problem:
Port ConflictSolution:
Change port during installation:
3307Forgot Root Password
Solution:
Reset MySQL root password using recovery mode.
Service Not Running
Windows:
services.mscStart:
MySQL80Linux:
sudo systemctl start mysqlBest Practices
Use Strong Passwords
Keep MySQL Updated
Backup Databases Regularly
Avoid Using Root Account For Applications
Use MySQL Workbench For LearningQuick Commands Reference
Check Version:
mysql --versionLogin:
mysql -u root -pShow Databases:
SHOW DATABASES;Create Database:
CREATE DATABASE my_database;Use Database:
USE my_database;Summary
In this lesson, you learned:
- What MySQL is
- Why MySQL is popular
- Installing MySQL on Windows
- Installing MySQL on Linux
- Installing MySQL on macOS
- Verifying installation
- Using MySQL Workbench
- Running your first SQL query
- Common installation issues and solutions
You are now ready to start writing SQL queries in a real database environment.
Next Step
Continue to:
install-postgresql.mdx →
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Install MySQL.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this SQL topic.
Search Terms
sql, sql complete guide, sql tutorial, sql notes, complete, guide, setup, install
Related SQL Topics