This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).
Install MySQL 5.7 on macOS
- Installing Homebrew is effortless, open Terminal and enter :
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
At this time of writing, Homebrew has MySQL version 8 as default, but as we're aiming to get 5.7, we'll need to append
@5.7 to the default package key:
- Enter the following command :
$ brew info firstname.lastname@example.org
- Expected output: email@example.com: stable 5.7.22 (bottled) [keg-only]
To install MySQL enter :
$ brew install firstname.lastname@example.org
Install brew services first :
$ brew tap homebrew/services
Load and start the MySQL service :
$ brew services start email@example.com.
Expected output : Successfully started
Check of the MySQL service has been loaded :
$ brew services list1
Force link 5.7 version -
$ brew link firstname.lastname@example.org --force
Verify the installed MySQL instance :
$ mysql -V.
Expected output : Ver 14.14 Distrib 5.7.22, for osx10.13 (x86_64)
Open Terminal and execute the following command to set the root password:
mysqladmin -u root password 'yourpassword'
Important : Use the single ‘quotes’ to surround the password and make sure to select a strong password!
To manage your databases, I recommend using Sequel Pro, a MySQL management tool designed for macOS.
Current version available: 1.1.2
brew services start email@example.com - instruction is equal to :
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents $ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist