MySQL 8.0 Installation Masterclass: Windows & Mac Step-by-Step Guide for Beginners
This comprehensive tutorial walks beginners through installing MySQL 8.0 on Windows and Mac, covering version selection, download sources, step-by-step installation with screenshots, configuration choices, environment variable setup, verification, and troubleshooting common issues like port conflicts, missing Visual C++ libraries, and authentication errors.
Overview
This guide provides a beginner-friendly, step-by-step walkthrough for installing MySQL 8.0 on both Windows and macOS. It covers version selection, download sources, installation procedures, configuration choices, environment variable setup, verification, and common troubleshooting.
Prerequisites: Three Key Decisions
Version: Choose MySQL 8.0 stable release (not development versions or older 5.6/5.7).
Package type: Prefer installer packages (.msi for Windows, .dmg for macOS) over compressed archives for easier GUI-based installation.
Download source: Use the official MySQL site (https://dev.mysql.com/downloads/installer/ for Windows, https://downloads.mysql.com/archives/community/ for macOS) or a trusted mirror like Alibaba Cloud (https://developer.aliyun.com/mirror/) if the official site is inaccessible.
Downloading MySQL 8.0
On the download page, search for "8.0" (or desired version). For Windows, select the .msi file; for macOS, choose arm64 for Apple Silicon (M1/M2) or x86_64 for Intel. The article explains the difference between .asc (PGP signature for integrity verification) and .md5 (MD5 checksum for basic file integrity) files.
macOS Installation Walkthrough
Step 1: Run the Installer Package
Locate the downloaded .dmg in Finder, double-click to mount, then run the installer. Follow the prompts: Continue, Agree, Install. Enter your macOS password when prompted.
Step 2: Configuration Choices
The installer presents two authentication options:
Use Strong Password Encryption (recommended): MySQL 8.0 default SHA-256 based authentication. More secure; requires clients that support MySQL 8.0.
Use Legacy Password Encryption: Compatible with MySQL 5.x clients but less secure.
Select the strong option, then set a root password (minimum 8 characters, mixed case, numbers, symbols). Keep "Start MySQL Server after installation" checked.
Step 3: Verification and PATH Setup
Open Terminal and run mysql -uroot -p with your password. If you get zsh: command not found: mysql, the MySQL binary path is not in your PATH. Fix by adding it to ~/.zshrc:
echo 'export PATH=$PATH:/usr/local/mysql/bin' >> ~/.zshrc
source ~/.zshrcThen test again; you should see the MySQL monitor prompt.
Windows Installation Walkthrough
Step 1: Check Visual C++ Redistributable
MySQL 8.x requires the Microsoft Visual C++ 2015-2022 Redistributable (x64). Check via Win+R → appwiz.cpl → search "Microsoft Visual C++". If missing or damaged, download the latest from Microsoft's official page (https://learn.microsoft.com/zh-cn/cpp/windows/latest-supported-vc-redist?view=msvc-170) and install with administrator rights. Reboot after installation.
Step 2: Run MSI Installer with Admin Rights
Because .msi files cannot be directly run as administrator via right-click, use an elevated command prompt:
msiexec /i "C:\your\path\mysql-installer-community-8.0.44.msi"Step 3: Choose Setup Type
In the MySQL Installer, select Full (installs server, client, and all tools). Click Next, then Execute to install all components.
Step 4: Configuration Wizard
Config Type: Choose Development Computer (default).
Authentication: Same strong vs. legacy choice as macOS; keep default strong encryption.
Root Password: Set a strong password. Do not add extra users unless required.
Windows Service: Keep defaults (service name "MySQL80", auto-start, run as standard system account).
Apply Configuration: Click Execute to finalize.
Step 5: Environment Variables and Verification
Add the MySQL bin directory (default C:\Program Files\MySQL\MySQL Server 8.0\bin) to the system Path variable via Control Panel → System → Advanced System Settings → Environment Variables. Open a new command prompt and run mysql -uroot -p to verify.
Common Issues and Fixes
Windows: "Unable to Start MySQL Service"
Port 3306 occupied: Use Resource Monitor (Task Manager → Performance → Open Resource Monitor → Network → Listening Ports) to find and stop the conflicting process.
Insufficient admin rights during install: Re-run installer as administrator and choose Repair/Modify.
Configuration file ( my.ini ) errors: Locate my.ini in the install directory (or copy from my-default.ini). Ensure basedir and datadir use forward slashes or double backslashes. Verify the data directory exists and the service account (NETWORK SERVICE or Local System) has full control. Restart service with net start mysql.
Stuck processes: Use tasklist | findstr "mysql" and taskkill /f /t /im mysqld.exe, then run mysqld --console from the bin directory to see console output.
macOS: Forgotten Temporary Password
Stop MySQL Server via System Preferences → MySQL → Stop MySQL Server.
In Terminal, run sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables (enter macOS password).
Open a new Terminal, run mysql -u root (no password).
Execute: FLUSH PRIVILEGES; then ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'; Restart MySQL Server from System Preferences and login with new password.
Both Platforms: "mysql not recognized as internal or external command"
This indicates the bin directory is not in the system PATH. Follow the environment variable steps above for each OS.
Client Authentication Error: "1251 - Client does not support authentication protocol"
Occurs when an older client (using mysql_native_password) connects to a server configured with strong encryption. Fix by changing the root user's authentication plugin:
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password';
FLUSH PRIVILEGES;Summary
MySQL installation boils down to four key points: pick a stable version (8.0), use the GUI installer (.msi/.dmg), follow prompts carefully (run as admin on Windows), and remember the root password while configuring the PATH. The provided troubleshooting guide resolves the most frequent roadblocks, enabling beginners to proceed to SQL learning with tools like MySQL Workbench or Navicat.
Original author: Lao Tang, public account: Tang Gong Shi Shi Yan Xi Bi Ji.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Engineer Tang's Implementation Study Notes
Old Tang | Pseudo-full-stack tech player: writes code without going bald, manages projects without going crazy, delivers without staying up late. No formal tutorials here, only a "slacking-off" practical manual that cures system pain points. Focuses on Shell, SQL, Java, and delivery, turning complexity into simplicity and making efficiency fun.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
