美文网首页开发工具
Mac Homebrew使用

Mac Homebrew使用

作者: MicoCube | 来源:发表于2018-09-29 18:27 被阅读0次
  • 安装
ruby -e "$(curl --insecure -fsSLhttps://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 安装软件
brew install ***
  • 卸载
brew uninstall ***
  • 搜索
brew search /gi*/
  • 使用brew已安装的软件
brew list #显示已经安装的所有软件包
brew list 软件名称 #显示已经安装的该名称软件包的安装路径信息
  • 其他命令
 brew update #同步远程最新更新情况,对本机已经安装并有更新的软件用*标明
 brew outdated #查看已安装的哪些软件包需要更新
 brew upgrade git #更新单个软件包
 brew info git #查看软件包信息
 brew home git #访问软件包官方站
 brew cleanup #清理所有已安装软件包的历史老版本
 brew cleanup git #清理单个已安装软件包的历史版本
  • 使用国内源

    • 替换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
    
  • 重置brew源

    • 重置brew.git:
    cd "$(brew --repo)"
    git remote set-url origin https://github.com/Homebrew/brew.git
    
    • 重置homebrew-core.git:
    cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    git remote set-url origin https://github.com/Homebrew/homebrew-core.git
    
  • 禁用自动更新

# 使用国内源当然还是会出现每次install的时候都会卡一下Updating Homebrew...的情况,
# 这时候就可以设置Homebrew更新为手动更新,这样需要的时候运行brew update命令手动更新就可以了。
# 放到你的profile文件里永久生效,比如~/.bash_profile
export HOMEBREW_NO_AUTO_UPDATE=true

Homebrew 安装mysql

  • 安装mysql:
brew install mysql
  • 设置mysql为开机启动项目:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
  • 启动mysql
mysql.server start
  • 设置密码:
mysql_secure_installation
  • 运行mysql_secure_installation会执行几个设置:

a)为root用户设置密码
b)删除匿名账号
c)取消root用户远程登录
d)删除test库和对test库的访问权限
e)刷新授权表使修改生效

相关文章

网友评论

    本文标题:Mac Homebrew使用

    本文链接:https://www.haomeiwen.com/subject/bhpboftx.html