mac 环境的brew及其他软件的安装

brew相当于linux下的yum,能非常方便得管理各种软件包,这里整理一下brew安装及其他软件的安装。

brew的安装:

1.打开命令行工具

2.安装brew   命令为:ruby -e "$(curl --insecure -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3.如网络不行,出现错误,就先卸载之前的安装  命令为:ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

4.再次重复2步骤 

5.安装成功 ,输入brew -v命令,如果有版本显示则说明安装成功,如果提示-bash: brew: command not found mac  则需要执行

sudo vim .bash_profile

并加入配置export PATH=/usr/local/bin:$PATH,最后source .bash_profile使配置修改生效,这样就安装完了brew。

6.如果觉得官方太慢,可以切换国内镜像,使用的比较多的就是中科大的源

(1)替换默认源 
第一步:替换brew.git

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
第二步:替换homebrew-core.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
cd 
brew update
(2)替换Homebrew Bottles源

对于bash用户:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

brew下的mysql安装:

1.$ brew install mysql

2.开启或关闭mysql命令   mysql.service start(stop)

3.配置mysql信息($ mysql_secure_installation)

Press y|Y for Yes, any other key for No: N   // 这个选yes的话密码长度就必须要设置为8位以上
New password:             // 设置密码
Re-enter new password:     // 再一次确认密码
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y    // 移除不用密码的那个账户
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n  //不接受root远程登录账号
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y  //删除text数据库

4.mysql8 navicat 连接 mysql 出现Client does not support authentication protocol requested by server解决方法:

USE mysql; 
alter user ‘root’@’localhost’ identified with mysql_native_password by ‘root’; 
FLUSH PRIVILEGES;

5.之后开启或关闭命令可以用:

# 启动 mysql, 并设置为开机启动
brew services start mysql
# 关闭 mysql
brew services stop mysql
# 重启 mysql
brew services restart mysql

brew安装redis

1.$ brew install redis

2.$ redis-server  启动redis服务

brewa安装zookeeper

1.$ brew install zookeeper

2$ zkServer start stop 开启或关闭服务  zkServer status  查看状态

猜你喜欢

转载自blog.csdn.net/oushitian/article/details/83443920
今日推荐