1. Download the installation package
http://
Find the following download
MYSQL-5.7.21-1-MACOS10.13-X86_64.DMG is
HTTPS://cdn.mysql.com//DOWNLOADS/MYSQL-5.7/MYSQL-5.7.21-1-MACOS10.13-X86_64.DMG
2. After downloading, follow the prompts to install
Follow the installation steps to save the MySQL root password in the last pop-up box.
3. After installation, you need to start
Open the settings and click MySQL to open the MySQL server, if necessary, whether to start the boot
4. Setting Environment variables
At this point we enter the mysql-uroot-p command at the command line at this point, we will prompt for no commod not found, we also need to add MySQL to the system environment variable.
(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.
Finally, enter source ~/.bash_profile on the command line
5, because I forgot the password, this step is the Mac under the change of MySQL password
To stop MySQL from the command line:
You have to use the root account.
Yuchaodemacbook-pro:support-files root#./
' /usr/local/mysql/data/yuchaodemacbook-pro.local.err ' . SUCCESS! yuchaodemacbook-pro:support-files root#./mysql.server stop shutting down MySQL. SUCCESS!
Yuchaodemacbook-pro:support-files root# pwd
/usr/local/mysql/support-files
6. If there is an error, there is no PID file
Delete/usr/local/mysql/data/*. Err
7, skip the authorization form, modify the password PS aux |grep mysql
#这一步, you must close mysql!!!!!! Skip Permission Validation
Yuchaodemacbook-pro:bin root#./mysqld_safe--skip-grant-tables &
#直接用root登陆, no password required
./mysql-uroot
#修改密码
Update Mysql.user set authentication_string =password (' Redhat ') where user= ' root ';
#刷新表
Flush privileges;
#重启mysql服务, the process of skipping the authorization form is automatically turned off!!
Yuchaodemacbook-pro:bin root#. /support-files/mysql.server restart
8.!!!!!!!!!!!!!!!!!!!!!!!!!
MacOS Install MySQL and change root password