Install MySQL on Sierra using Homebrew
This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :
$ brew info mysql
To install MySQL enter : $ brew install mysql
Install brew services first : $ brew tap homebrew/services
Load and start the MySQL service : $ brew services start mysql
.
Expected output : Successfully started mysql
(label: homebrew.mxcl.mysql)
Check of the MySQL service has been loaded : $ brew services list
1
Verify the installed MySQL instance : $ mysql -V
.
Expected output : Ver 14.14 Distrib 5.7.15, for osx10.12 (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
1 The brew services start mysql
- instruction is equal to :
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
https://www.memoinfo.fr/tutoriels-linux/guide-sauvegarde-restauration-mysql/
https://www.hivelocity.net/kb/using-mysql_upgrade-command/
Restore only one database from a dump http://www.darrenmothersele.com/blog/2012/01/10/restore-single-db-from-complete-mysql-dump/
mysql -u root -p --one-database destdbname < alldatabases.sql