I add this here because I encountered this problem several times after installing other software. MySQL worked fine for several days, and then suddenly I got this error.
This happens when I install something (like elasticsearch or the Puma web server). MySql permissions are returned again (back to me, not _mysql ). I do not know why.
- Macos sierra
- Homebrew 1.0.5-43-g41b2df8 (2016-10-02)
- MySQL 5.7.15
So, I found that one of the reasons for this is permission to the location where MySQL stores your databases, which are by default here:
/usr/local/var/mysql
If you look in this folder, you will see a file
<your computer name>.err
If you look inside this file ( more it or cat it), you will probably see this error:
[ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
If so, you know this is a permissions issue.
If you don't care, you can just start MySQL by simply starting mysqld (and leave this terminal open).
If you don't care:
ls -al /usr/local/var/mysql
You will notice that permissions are probably all set for you (your user account). This means that mysql cannot mount your databases at startup using the homebrew shortcut sudo mysql.server start [even if you use sudo to run in "admin" mode].
So change the permissions:
$ sudo chown -R _mysql /usr/local/var/mysql $ sudo chmod -R o+rwx /usr/local/var/mysql
Then it will work.
rmcsharry Oct 02 '16 at 18:34 2016-10-02 18:34
source share