我需要使用 M1 在我的 MacBook 上安装特定版本的 MySQL (5.7)。
我正在尝试使用 Homebrew 来做到这一点。
brew install mysql@5.7
输出:
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
mysql@5.7 is keg-only, which means it was not symlinked into /opt/homebrew, 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="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc
For compilers to find mysql@5.7 you may need to set: export LDFLAGS="-L/opt/homebrew/opt/mysql@5.7/lib" export CPPFLAGS="-I/opt/homebrew/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: /opt/homebrew/opt/mysql@5.7/bin/mysql.server start
在那之后,我尝试运行:
echo 'export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc
source .zshrc
mysql_secure_installation
并得到错误:
Securing the MySQL server deployment.
Enter password for user root:
Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
另外,我试过:
brew services start mysql@5.7
并且还得到错误:
Error: Permission denied @ rb_sysopen - /Users/vivanc/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist
似乎存在与权限相关的问题。任何建议表示赞赏。