MySQL Installation
System Requirements
Before installing MySQL, ensure your system meets the minimum requirements:
Hardware Requirements
| Component |----------------|--------------|-----------------| | CPU | RAM | Disk Space | Network
Software Requirements
MySQL is available on multiple platforms:
- Windows: Windows 10/11, Windows Server 2016+
- macOS: macOS 10.15+
- Linux: Most distributions (Ubuntu, Debian, CentOS, RHEL, etc.)
- Unix: FreeBSD, Solaris
Windows Installation
Method 1: MySQL Installer (Recommended)
-
Download MySQL Installer
- Visit https://dev.mysql.com/downloads/installer/
- Download mysql-installer-community-8.0.x.msi
-
Run the Installer
- Double-click the downloaded .msi file
- If prompted by User Account Control, click "Yes"
-
Choose Setup Type
-
Check Requirements
- Installer will check for missing prerequisites
- Install any required components
-
Installation
- Review components to install
- Click "Execute" to begin installation
- Wait for download and installation
-
Configuration
- Configuration type: Standalone
- Port: 3306 (default)
- Authentication method: Strong password encryption
- Set root password
- Create user accounts (optional)
-
Complete Installation
- Click "Finish" when complete
Method 2: ZIP Archive
-
Download MySQL ZIP Archive
- Visit https://dev.mysql.com/downloads/mysql/
- Download mysql-8.0.x-winx64.zip
-
Extract Files
-
Initialize MySQL
-
Start MySQL Service
-
Connect to MySQL
Method 3: Docker
macOS Installation
Method 1: Homebrew (Recommended)
-
Install Homebrew
-
Install MySQL
-
Initial Setup
-
Add to PATH
Method 2: DMG Package
-
Download DMG Package
- Visit https://dev.mysql.com/downloads/mysql/
- Download mysql-8.0.x-macos11-x86_64.dmg
-
Run Installation
- Open the downloaded .dmg file
- Double-click mysql-8.0.x.pkg
- Follow installation wizard
- Set temporary password (shown in installer)
-
Start MySQL
-
Change Root Password
Method 3: Docker
Linux Installation
Ubuntu / Debian
Step 1: Update Package Index
Step 2: Install MySQL
Step 3: Secure MySQL Installation
The secure installation script will guide you through:
Step 4: Start MySQL Service
Step 5: Connect to MySQL
CentOS / RHEL / Rocky Linux
Step 1: Add MySQL Repository
Step 2: Install MySQL
Step 3: Start MySQL Service
Step 4: Secure Installation
Fedora / Fedora
Verification
Check MySQL Version
Test Connection
Check Service Status
Post-Installation Configuration
Setting Root Password
Creating a New User
Configuring Remote Access
Configuration File Location
| Platform |---------------|----------------| | Windows | C:\ProgramData\MySQL\MySQL Server 8.0\my.ini | | macOS | /etc/my.cnf or /usr/local/etc/my.cnf | | Linux (Ubuntu/Debian) | /etc/mysql/mysql.conf.d/mysqld.cnf | | Linux (CentOS/RHEL) | /etc/my.cnf |
Docker Installation
Install Docker
Windows / macOS
- Download Docker Desktop from https://www.docker.com/products/docker-desktop
- Install and start Docker Desktop
Linux
Run MySQL with Docker
Docker Compose / Docker Compose
Create docker-compose.yml:
Run with:
Troubleshooting
Common Installation Issues
MySQL Service Won't Start
Access Denied Errors
Port Already in Use
Check MySQL Logs
Uninstallation
Windows
- Use Control Panel > Programs and Features
- Find MySQL and click "Uninstall"
- Use MySQL Installer to remove all components
- Delete remaining files manually
macOS
Linux
Summary
MySQL installation varies by platform:
- Windows: Use MySQL Installer for easy setup
- macOS: Use Homebrew or DMG package
- Linux: Use package manager (apt, dnf, yum)
- Cross-platform: Use Docker for consistent environment
Key steps after installation:
- Secure installation - Run mysql_secure_installation
- Set root password - Create a strong password
- Create users - Create users with appropriate privileges
- Configure remote access - If needed
- Backup configuration - Keep configuration files safe
Next Steps
Continue to MySQL Administration to learn how to manage and configure MySQL server.
Previous: Introduction
Next: Administration