Mac下安装brew、mysql等软件

一、安装brew

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

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

二、安装mysql

1、安装

brew install mysql@5.7

此时会输出:

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、添加环境变量

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

3、启动

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、设置开机自启动

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

3、重启机器

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值