First, download the installation
Download the community version of DMG installation file: https://dev.mysql.com/downloads/mysql/
1, execute the installation files, follow the steps to complete the installation.
2, after the completion of installation terminal input:
-- version;
----Show the version number is normal, if the command not found, in the terminal input as follows, "/usr/local/mysql/bin/mysql" is the MySQL default installation path:
/usr/local/bin/-/usr/local/ MySQL/bin/MySQL MySQL
3. Turn off the MySQL service:
/usr/local/MySQL/support-files/mysql.server Stop
Second, the environment variable configuration
1, open The terminal, enter:
~
Will enter the ~ folder
2. then enter:
Touch. Bash_profile
After the carriage return is executed,
3. re-enter:
Open -E. bash_profile
This file is opened in TextEdit (this should be a blank document if the environment variable has not been previously configured). If you have content, enter it before the Terminator, and if there is no content, enter the following statement directly:
Export Path=${path}:/usr/local/mysql/bin
Then, save, Exit TextEdit(must be exited), close the terminal and exit.
Third, forget the root password reset
1. turn off the MySQL service (click Stop MySQL server) , System Preferences , Apple
2. Enter the terminal input:
/usr/local/mysql/bin/
Login Administrator rights after Enter
Enter the following command after carriage return to disable the MySQL authentication feature
. / -- Skip-grant-tables &
MySQL will restart automatically after carriage return ( the MySQL status in Preferences will become running)
3. Input command
. /MySQL
Enter the command after the carriage return
privileges;
Enter the command after the carriage return
SET for ' Root '@'localhost'= PASSWORD ('123'
At this end of the modification, after restarting the terminal, enter mysql-u root-p return and type the password:123 will start successfully.
Iv. deletion
Stop The MYSQL process and console enter the command .
1, sudo rm/Usr/Local/MySQL2, sudo rm-Rf/Usr/Local/Mysql*3, sudo rm-Rf/Library/Startupitems/mysqlcom4, sudo rm-Rf/Library/Preferencepanes/My*5Vim/etc/Hostconfig ( andRemoved the line mysqlcom=-YES-)6Rm-Rf~/Library/Preferencepanes/My*7, sudo rm-Rf/Library/Receipts/Mysql*8, sudo rm-Rf/Library/Receipts/Mysql*9, sudo rm-Rf/var/Db/Receipts/Com.mysql.*
MySQL installation configuration on Mac