On the Mac brew install mysql

brew install mysql

You can specify the version installed, do not specify a default version of the latest version

brew install [email protected]

Modify environment variables

brew install things that are in  
 
 / usr / local / Cellar /   

down path, all need to find into the inside mysql then go layer by layer until you find a bin directory, then the path get 

my computer is:

 / usr / local / Cellar /[email protected]/5.7.23/ bin (mysql version may be different, a different path, change directory to find himself on the ok)

 1 ) input terminal command 
sudo vim .bash_profile

 2 ) enter the bottom of the document: 

Export the pATH = $ the pATH: /usr/local/Cellar/[email protected]/5.7.23/ bin 

then esc exit insert state, and at the bottom of the: wq save and exit. 

3 ) Input: 

Source .bash_profile 

Enter execution, operating environment variables.

4. Other 
The above practices are each turned off to open the terminals need to source .bash_profile. Thus vi ~ / .zshrc, in which there is added: 

Export the PATH = $ {} the PATH: / usr/local/Cellar/[email protected]/5.7.23/bin 

after storage source ~ / .zshrc 

so would make all this .
 

 Start mysql service

mysql.server start

 

Guess you like

Origin www.cnblogs.com/tingguoguoyo/p/10991228.html