Install MySQL on macOS

Page content

Install

Install MySQL in macOS with the installer

Use official installer.

MySQL - Official Download page: https://dev.mysql.com/downloads/mysql/

Initial password of the root user

The root means the MySQL root user, not your macOS You should take a memo your password of root user (not Linux system super user.)

For CLI

After running installer, add the PATH to ~/.zshrc (or your shell. Check with $echo SHELL).

alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin

Check the version

mysql --version
/usr/local/mysql/bin/mysql  Ver 8.0.19 for macos10.15 on x86_64 (MySQL Community Server - GPL)