2

I am trying to run MySQL installed through HomeBrew on a Mac (High Sierra) but I am always having these problems of permissions and with the PID file. I have tried hundreds of possible solutions I found online, but I could not fix these issues:

Haline:/ Haline$ mysql.server start
Starting MySQL
./usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe: line 144: /usr/local/var/mysql/Haline.local.err: Permission denied
/usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe: line 144: /usr/local/var/mysql/Haline.local.err: Permission denied
/usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe: line 199: /usr/local/var/mysql/Haline.local.err: Permission denied
/usr/local/Cellar/mysql/8.0.12/bin/mysqld_safe: line 144: /usr/local/var/mysql/Haline.local.err: Permission denied
 ERROR! The server quit without updating PID file (/usr/local/var/mysql/Haline.local.pid).

Can anyone help me, pleeease?

Haline
  • 21
  • 1
  • 5
  • It would indicate a file permissions problem. Check that the user running the command has the correct permissions/groups for these files and `chmod/chown` as necessary. – Jason Armstrong Dec 10 '18 at 21:53

1 Answers1

7

According to the official troubleshooting page of Homebrew:

If commands fail with permissions errors, check the permissions of /usr/local’s subdirectories. If you’re unsure what to do, you can run cd /usr/local && sudo chown -R $(whoami) bin etc include lib sbin share var opt Cellar Caskroom Frameworks.

Alternatively, if you have not installed applications in /usr/local that rely on specific permissions, you can also run:

sudo chown -R $(whoami) /usr/local/*
Ortomala Lokni
  • 56,620
  • 24
  • 188
  • 240
  • 1
    That did it for me! On Apple silicon use cd /opt/homebrew/ && sudo chown -R $(whoami) bin etc include lib sbin share var opt Cellar Caskroom Frameworks instead, as Homebrew installs to a different directory than previously – matthewiannowlin Feb 17 '23 at 17:00
  • this along with this https://stackoverflow.com/a/55157844/3852169 brought end to my 2 hours struggle in finding useless logs!! – ronit Jun 17 '23 at 21:32
  • sudo chown -R $(whoami) /opt/homebrew/* also works on me – fxbayuanggara Jul 24 '23 at 22:31