MySQL — Installation
Windows Installation
- Download MySQL Installer from mysql.com
- Run the installer
- Choose "Developer Default" or "Custom"
- Set root password
- 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:
- Downloads MySQL
- Runs the installer
- Sets root password
- 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.