Download the latest MySQL Community edition
Official: http://dev.mysql.com/downloads/mysql/
It is recommended to download the DMG installation package for easy installation.
The latest version is 5.7.11.
Install MySQL
- Double-click the mysql-5.7.9-osx10.10-x86_64.dmg file to load the image
- Double-click Mysql-5.7.9-osx10.9-x86_64.pkg to start the installation
- The next step, you can install successfully
- Note: After the installation is complete, a dialog box will appear, telling us that a temporary password for the root account has been generated. Remember to save, or resetting your password will be cumbersome.
Start MySQL
Open System Preferences, you will find a more MySQL icon, click on it, will enter the MySQL settings interface:
After installation, the default MySQL status is stopped, closed, need to click the "Start MySQL Server" button to start it, after booting, the status will become running.
There is also a check box button below, you can set whether to automatically start MySQL when the system starts, the default is checked, it is recommended to cancel, save boot time.
Connect to MySQL via terminal
Open terminal, append MySQL bin directory to path Path
PATH="$PATH":/usr/local/mysql/bin
Then log in to MySQL with the following command (the password is the temporary password that was automatically generated earlier)
mysql -u root -p
Login is successful, but when the command is run, an error will be made, prompting us to reset the password.
Change password, new password is 123456
set PASSWORD =PASSWORD(‘123456‘);
Execute show databases again; it's normal.
Install MySQL on Mac