I've been installing Node, NVM, NPM and some other tools lately on my MacBook. After a while, suddenly, I discovered that mysqld wasn't booting anymore due to the following:
Operating system error number 13 in a file operation. The error means mysqld does not have the access rights to the directory.
I figured I should reinstall mysql with brew, but doing that led to:
$ brew remove mysql
Uninstalling /usr/local/Cellar/mysql/5.6.17_1...
Error: Permission denied - /usr/local/include/mysql
Than tried:
$ brew cleanup
Removing: /usr/local/Cellar/openssl/1.0.1g...
Error: Permission denied - /usr/local/Cellar/openssl/1.0.1g/bin/c_rehash
Also installing fails:
$ brew install mysql
Error: Cannot write to /usr/local/Cellar
I didn't change anything to brew or it's directories, so this problem is coming from somewhere else. I remember when installing NVM I made some changes to permissions, but can't remember exactly what is was..
Turns out in the past I changed the owner of /usr/local. Changing it back to whoami did the trick..