Haline
Haline

Reputation: 51

Cannot start MySQL on Mac - Permission denied

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?

Upvotes: 5

Views: 7715

Answers (2)

Alex
Alex

Reputation: 54

I had a similar problem on Mac Sonoma. The following steps solved the issue for me:

rm -rf /opt/homebrew/var/mysql
uninstall mysql
install mysql

mysql.server start should work now

Upvotes: -1

Ortomala Lokni
Ortomala Lokni

Reputation: 62456

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/*

Upvotes: 12

Related Questions