mac通过brew方式安装mysql5.7

1、查询mysql包

brew search mysql

2、安装msyql5.7(上一步确认是否有这个包名称)

brew install [email protected]

等一段时间后,安装成功后显示

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"' >> /Users/boolean/.bash_profile

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"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"


To restart [email protected] after an upgrade:
  brew services restart [email protected]
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/[email protected]/bin/mysqld_safe --datadir=/usr/local/var/mysql
==> Summary
  /usr/local/Cellar/[email protected]/5.7.37: 320 files, 234.2MB
==> Running `brew cleanup [email protected]`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

3、启动mysql

/usr/local/opt/[email protected]/bin/mysql.server start

4、登录mysql

通过命令行登录mysql

 /usr/local/opt/[email protected]/bin/mysql -uroot -p

通过navacat软件 登录mysql

mac通过brew方式安装mysql5.7_第1张图片

你可能感兴趣的:(php,mysql,数据库)