## 搜索可用版本
brew search mysql
## 安装制定版本
brew install [email protected]
## 重点需要关注的安装日志如下
==> Installing [email protected]
==> Pouring [email protected]_1.sonoma.bottle.tar.gz
==> /usr/local/Cellar/[email protected]/8.0.36_1/bin/mysqld --initialize-insecure --user=cookie. --basedir=/usr/local/Cellar/[email protected]/8.0
==> 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 -u root
[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 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/mysqld_safe --datadir\=/usr/local/var/mysql
==> Summary
标签:opt,8.0,Mac,export,usr,mysql,brew,local
From: https://www.cnblogs.com/DeepInThought/p/18109700