Mac下安装brew、mysql等软件

一、安装brew

官方的命令,报错443之类的,不用尝试了,直接用以下命令即可

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

二、安装mysql

1、安装

brew install [email protected]

此时会输出:

bogon:~ jinping$ brew install [email protected]
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/mysql%405.7-5.7.29.catalina.bottle.tar
######################################################################## 100.0%
==> Pouring [email protected]
==> /usr/local/Cellar/[email protected]/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

[email protected] 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 [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> /Users/jinping/.bash_profile

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"


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

2、添加环境变量

echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> /Users/jinping/.bash_profile
source ~/.bash_profile 

3、启动

brew services start [email protected]

4、连接mysql

mysql -u root

5、修改密码

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

三、安装redis

1、安装

brew install redis

2、设置开机自启动

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

3、重启机器

你可能感兴趣的:(Mac下安装brew、mysql等软件)