1

I'm trying to get a local mysql up and running on my macos machine. I am following theese instructions: https://laravel.com/docs/5.7/valet#installation

  • I am installing through Homebrew.
  • I have tried reinstalling mysql
  • I have two users: an administrator to install things, and a normal user account for my developing and normal activities. Perhaps this is what's causing the issues

What I expect:

MySQL to run every time I boot up my macbook as it used to do (no matter what user account I am logged into, preferably).

Error:

When I try to connect through Sequel Pro or running mysql -u root directly, I get error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

What I have tried

  • sudo brew services restart mysql@5.7. Running with success but mysql still doesn't work.
  • [admin:~]$ brew services start mysql@5.7 error Could not find domain for Error: Failure while executing; /bin/launchctl enable gui/501/homebrew.mxcl.mysql@5.7 exited with 112.
  • Followed instructions of: MacOSX: autostart mysql on boot
  • Tried starting manually from my normal user account: [myuser:~]$ mysql.server start error: Starting MySQL ./usr/local/Cellar/mysql@5.7/5.7.24/bin/mysqld_safe: line 144: /usr/local/var/mysql/mymacname.local.err: Permission denied
bfontaine
  • 18,169
  • 13
  • 73
  • 107
FooBar
  • 5,752
  • 10
  • 44
  • 93
  • Possible duplicate of [MacOSX: autostart mysql on boot](https://stackoverflow.com/questions/8014500/macosx-autostart-mysql-on-boot) – delboy1978uk Oct 26 '18 at 12:33

1 Answers1

3

So I finally found the solution, turned out it was quite simple. I tried reinstalling several times, etc, but in the end what worked was to fix the permissions brew didn't manage to, after a installing via brew.

Running

sudo chown -R _mysql:mysql /usr/local/var/mysql

Then restarting the mysql server:

sudo brew services restart mysql@5.7

Solved the issue

FooBar
  • 5,752
  • 10
  • 44
  • 93
  • Absolutely outrageous - this solved the problem for me as well. I don't understand why there were no error messages (that I could find, at least) that pointed to this solution, but simply chowning `/usr/local/var/mysql` (and its contents) allowed mysql to run at boot. Thank you for posting this! – Brian Kendig Apr 15 '19 at 03:26
  • this is hilarious. this solved my problem after hours and hours of trying – dczii Aug 16 '21 at 12:41