1. Download MySQL
Visit MySQL's official website http://www.mysql.com/downloads/then you will see a "download" click under "MySQL Community Server" on the page.
Go to MySQL Download interface (http://www.mysql.com/downloads/mysql/), if you are using Mac OS to access, then it will be the default for you to choose the Mac OS X platform, and the following are listed in the Mac The version of MySQL that can be used on the OS, and if it is a different platform, just select it in the drop-down list of the "Select Platform" option.
There are many versions of MySQL on Mac OS, including platforms such as 10.5/10.6, then there are 32-bit and 64-bit, which you choose according to your own system, Then there is the suffix name of the file. tar.gz and. DMG, here I choose. dmg. Click Download on the right to download.
I'm just sticking it out here. Latest Address:
wget HTTPS://DEV.MYSQL.COM/GET/DOWNLOADS/MYSQL-5.7/MYSQL-5.7.19-MACOS10.12-X86_64.DMG
2. Install MySQL
After downloading, click on the DMG installation package, follow the installation steps down the road, remember to save the last pop-up box password (it is your MySQL root account password)
3. Start the MySQL service off
Click "System Preferences"--- open "Settings" and click "MySQL"
Now you can login MySQL through mysql-uroot-p, will let you enter the password, just install the last step in the box password
After the login is successful, you can change the password through the following command, then restart the MySQL service setpasswordfor ' root ' @ ' localhost ' =password (' Newpass ').
This article is from the "Ma Pengfei" blog, make sure to keep this source http://mapengfei.blog.51cto.com/1552412/1964931
Install MySQL service on Mac