使用brew安装MySQL软件后,通过brew services start mysql启动mysql,返回下面的错误:
zhangzhijun@ZhangZhijun-MacBook ~ % brew services start mysql
Error: Your Homebrew is too outdated for `brew services`. Please run `brew update`!
但是使用brew update之后,并没有升级homebrew,只是提示brew already up to date。
查询了官网,发现brew的版本已经到4.3了,本地的还是4.1。经过分析,由于使用了阿里镜像的原因,应该是镜像的问题导致的。参考阿里云回退镜像的方法,回退为默认的配置,然后执行brew update,更新到了最新的brew版本,问题得到解决。
配置回退方法如下:
unset HOMEBREW_BREW_GIT_REMOTE
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew
unset HOMEBREW_API_DOMAIN
unset HOMEBREW_CORE_GIT_REMOTE
BREW_TAPS="$(BREW_TAPS="$(brew tap 2>/dev/null)"; echo -n "${BREW_TAPS//$'\n'/:}")"
for tap in core cask{,-fonts,-versions} command-not-found services; do
if [[ ":${BREW_TAPS}:" == *":homebrew/${tap}:"* ]]; then
brew tap --custom-remote "homebrew/${tap}" "https://github.com/Homebrew/homebrew-${tap}"
fi
done
brew update
# 如果您之前永久配置了 HOMEBREW 环境变量,还需要在对应的 ~/.bash_profile 或者 ~/.zshrc 配置文件中,将对应的 HOMEBREW 环境变量配置行删除
阿里云镜像:https://developer.aliyun.com/mirror/homebrew?spm=a2c6h.13651102.0.0.5d7d1b11XsiFSy