Mac下安裝brew、mysql等軟件

一、安裝brew

官方的命令,報(bào)錯(cuò)443之類的,不用嘗試了,直接用以下命令即可

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

二、安裝mysql

1、安裝

brew install mysql@5.7

此時(shí)會(huì)輸出:

bogon:~ jinping$ brew install mysql@5.7
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/mysql%405.7-5.7.29.catalina.bottle.tar
######################################################################## 100.0%
==> Pouring mysql@5.7-5.7.29.catalina.bottle.tar.gz
==> /usr/local/Cellar/mysql@5.7/5.7.29/bin/mysqld --initialize-insecure --user=jinping --basedir=/usr/local/Cellar/m
==> Caveats
We've installed your MySQL database without a root password. To secure it run:
    mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:
    mysql -uroot

mysql@5.7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have mysql@5.7 first in your PATH run:
  echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> /Users/jinping/.bash_profile

For compilers to find mysql@5.7 you may need to set:
  export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"
  export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"


To have launchd start mysql@5.7 now and restart at login:
  brew services start mysql@5.7
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/mysql@5.7/bin/mysql.server start
==> Summary
??  /usr/local/Cellar/mysql@5.7/5.7.29: 319 files, 232.3MB

2、添加環(huán)境變量

echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> /Users/jinping/.bash_profile
source ~/.bash_profile 

3、啟動(dòng)

brew services start mysql@5.7

4、連接mysql

mysql -u root

5、修改密碼

set password for root@localhost = password('123'); 

三、安裝redis

1、安裝

brew install redis

2、設(shè)置開機(jī)自啟動(dòng)

ln -f /usr/local/Cellar/redis/6.0.5/homebrew.mxcl.redis.plist  ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

3、重啟機(jī)器

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容