</>
Skip to content
MySQL lessons (4/48)

MySQL — Installation

Windows Installation

  1. Download MySQL Installer from mysql.com
  2. Run the installer
  3. Choose "Developer Default" or "Custom"
  4. Set root password
  5. Complete installation

macOS Installation

# Using Homebrew
brew update
brew install mysql

# Start MySQL
brew services start mysql

# Secure installation
mysql_secure_installation

Linux Installation

# Ubuntu/Debian
sudo apt update
sudo apt install mysql-server

# Start and enable
sudo systemctl start mysql
sudo systemctl enable mysql

# Secure installation
sudo mysql_secure_installation

Docker Installation

# Pull MySQL image
docker pull mysql:8.0

# Run container
docker run --name mysql-container -e MYSQL_ROOT_PASSWORD=password -p 3306:3306 -d mysql:8.0

# Connect
docker exec -it mysql-container mysql -u root -p

Verifying Installation

# Check version
mysql --version

# Connect to server
mysql -u root -p

# Show status
STATUS;

Configuration Files

# my.ini (Windows)
[mysqld]
port=3306
datadir=C:/ProgramData/MySQL/MySQL Server 8.0/Data

# my.cnf (Linux)
[mysqld]
port=3306
datadir=/var/lib/mysql

Mini Practice

Install MySQL that:

  1. Downloads MySQL
  2. Runs the installer
  3. Sets root password
  4. Verifies installation

Up Next

Next: Learn about MySQL Syntax.

Related Topics

Frequently Asked Questions about Installation

What is Installation in MySQL?

Installation is a fundamental concept in MySQL. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Installation?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Installation.

Why is Installation important in MySQL?

Installation is essential for MySQL development. Understanding this concept will help you write better code and solve real-world problems more effectively.