我正在尝试在 MACOSX High Sierra 上安装 Laravel Valet。我已经按照 Valet 主页上的说明安装了 homebrew、php 7.3、mysql@5.7。运行 brew services start 时我必须使用 sudo。
我得到的错误是: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)ERROR 2002 (HY000): Can't connect to local MySQL server through socket ' /tmp/mysql.sock' (2)
我试过 sudo brew services restart mysql@5.7
我已经尝试重新安装代客。
我已将 mysql@5.7 添加到我的路径中。
如果我运行 brew info mysql@5.7:
mysql@5.7: stable 5.7.28 (bottled) [keg-only]
Open source relational database management system
https://dev.mysql.com/doc/refman/5.7/en/
/usr/local/Cellar/mysql@5.7/5.7.28 (319 files, 235.3MB) *
Poured from bottle on 2019-10-15 at 10:09:30
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/mysql@5.7.rb
==> Dependencies
Build: cmake ✘
Required: openssl@1.1 ✔
==> 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
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"
For pkg-config to find mysql@5.7 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/mysql@5.7/lib/pkgconfig"
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
==> Analytics
install: 22,455 (30 days), 70,097 (90 days), 260,848 (365 days)
install_on_request: 22,327 (30 days), 69,830 (90 days), 260,028 (365 days)
build_error: 0 (30 days)
如果有人能指出我如何解决这个问题的正确方向,将不胜感激。我意识到有人问过类似的问题,但我一直在尝试,但我没有看到任何发布的作品。我想我需要完全删除 mysql 版本,但我同时拥有 mysql、mysql@5.6 和 mysql@5.7,感觉无法重新开始。