1. Download MySQL for mac:https://dev.mysql.com/downloads/installer/
2. Double-click mysql-5.7.17-macos10.12-x86_64.dmg to Unzip, double-click mysql-5.7.17-macos10.12-x86_64.pkg to install
3. Continue, Continue, Agree, Install, enter the administrator password
4. Record the password in the pop-up window
5. Go to System Preferences, find MySQL, start the service
6. Add MySQL commands to the system
(1). Go to/usr/local/mysql/bin to see if there is MySQL in this directory
(2). Perform Vim ~/.bash_profile
Add the Mysql/bin directory to the file
Path= $PATH:/usr/local/mysql/bin
When you are finished adding, press ESC, and then enter Wq save.
(3). Finally enter source ~/.bash_profile on the command line
7. Log in to MySQL via Mysql-uroot-p and enter the previously saved password
8. Reset MySQL Initial password
[SQL]View PlainCopy
- SET PASSWORD for ' root ' @' localhost ' = PASSWORD (' newpassword ');
Reference article:
Two ways to install MySQL on Mac: HTTP://WWW.JIANSHU.COM/P/FD3AAE701DB9
Install the MySQL database on your Mac