0

I am trying to install Laravel Valet on MAcOSX High Sierra. I have followed the instructions on the Valet homepage, installed homebrew, php 7.3, mysql@5.7. I have to use sudo when running brew services start.

The error I get is: 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)

I have tried sudo brew services restart mysql@5.7

I have tried reinstalling Valet.

I have added mysql@5.7 to my path.

If I run 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)

It would be much appreciated if someone could point me in the right direction of how to fix this. I realise similar questions have been asked but I have been trying forever but nothing I've seen posted works. I think I need to completely remove mysql versions but I have both mysql, mysql@5.6 and mysql@5.7 and feel like it is impossible to start over.

olv53
  • 63
  • 13

1 Answers1

2

First, in your terminal try to check:

 type -a mysql

If everything is done right, you will see

mysql is /usr/local/bin/mysql

Then try to run:

sudo mysql.server start
Eldar Gadirov
  • 21
  • 1
  • 5