Homebrew(brew)安装MySQL成功后无法登录

时间:2024-01-21 19:40:37

Homebrew简称brew,OSX上的软件包管理工具,在Mac终端可以通过brew安装、更新、卸载各种软件,(简直就是神器级武器)。

废话不多说,没安装brew自己去百度学习安装,这里就不多说了。

1、首先在终端使用命令,这是搜索brew上的MySQL各个版本
brew search mysql
2、选择自己需要的版本,安装MySQL,这里我安装为5.7版本
brew install mysql@5.7
3、执行后稍等片刻,它会自动安装,以下为安装成功后显示的信息
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"' >> ~/.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