设置 Laravel Valet Mysql 问题
Posted
技术标签:
【中文标题】设置 Laravel Valet Mysql 问题【英文标题】:Setting up Laravel Valet Mysql issues 【发布时间】:2020-02-11 22:35:27 【问题描述】:我正在尝试在 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
我已尝试重新安装 Valet。
我已将 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,感觉无法重新开始。
【问题讨论】:
【参考方案1】:首先,在您的终端中尝试检查:
type -a mysql
如果一切都做对了,你会看到
mysql is /usr/local/bin/mysql
然后尝试运行:
sudo mysql.server start
【讨论】:
以上是关于设置 Laravel Valet Mysql 问题的主要内容,如果未能解决你的问题,请参考以下文章
cURL + Laravel Valet + dnsmasq 不工作
Laravel Valet php-fpm 已经在监听 valet sock
sh 安装并激活WooCommerce和Storefront的新WordPress站点。您必须安装Laravel Valet或Valet +