在Mac上brew install MySQL

通过brew 安装MySQL5.7

#查看brew已安装的
brew install list 
#搜索mysql可以安装的版本 brew install mysql是安装的8.0版本
brew search mysql
brew install [email protected]

安装后的信息

==> Reinstalling [email protected]
==> Downloading https://homebrew.bintray.com/bottles/[email protected]
Already downloaded: /Users/onefiter/Library/Caches/Homebrew/downloads/665d7cef7caaddc43ad93397ebb4a9cf1737a905403381440be05956e06e35a2--mysql@5.7-5.7.26.mojave.bottle.tar.gz
==> Pouring [email protected]
==> 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

[email protected] 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 [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"


To have launchd start [email protected] now and restart at login:
  brew services start [email protected]
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/[email protected]/bin/mysql.server start
==> Summary
  /usr/local/Cellar/[email protected]/5.7.26: 320 files, 231.8MB

对MySQL进行配置

设置密码
#设置密码以及删除一些账户
mysql_secure_installation

注:

若之前有安装过MySQL,请删除rm -rf /usr/local/var/mysql 再进行安装brew install [email protected]

你可能感兴趣的:(在Mac上brew install MySQL)