How to repair mysql after Sierra Server Upgrade

In upgrading from Mountain Lion to Sierra, mysql no longer launches. I've been searching for instructions on how to fix this, but have not found anything.


This is what I get when trying to start mysql:

mysqld start

170721 20:18:13 [Warning] Can't create test file /usr/local/mysql-5.5.29-osx10.6-x86_64/data/uranium.lower-test

170721 20:18:13 [Warning] Can't create test file /usr/local/mysql-5.5.29-osx10.6-x86_64/data/uranium.lower-test

170721 20:18:13 [Note] Plugin 'FEDERATED' is disabled.

mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)

170721 20:18:13 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

170721 20:18:13 InnoDB: The InnoDB memory heap is disabled

170721 20:18:13 InnoDB: Mutexes and rw_locks use GCC atomic builtins

170721 20:18:13 InnoDB: Compressed tables use zlib 1.2.3

170721 20:18:13 InnoDB: Initializing buffer pool, size = 128.0M

170721 20:18:13 InnoDB: Completed initialization of buffer pool

170721 20:18:13 InnoDB: Operating system error number 13 in a file operation.

InnoDB: The error means mysqld does not have the access rights to

InnoDB: the directory.

InnoDB: File name ./ibdata1

InnoDB: File operation call: 'open'.

InnoDB: Cannot continue operation.

Mac Mini Server (Late 2012), macOS Sierra (10.12.3), Server v 5.2

Posted on Jul 21, 2017 7:11 PM

Reply
Question marked as Top-ranking reply

Posted on Sep 26, 2017 1:51 PM

In my case mysql failed after the update because the user running mysqld (The user mysql) being unable to open the mysql data directory with write permission. The files were instead owned by myself. I fixed this with:


sudo chown -R mysql /usr/local/mysql/*


The orignal cause (for me) was not the Sierra upgrade itelf, but the overall process of updating applications in response. Specifically other instructions online for updating PHP with brew after the Sierra update had included a chown:


sudo chown -R $(whoami):admin /usr/local # DO NOT DO THIS


This had unfortunately altered the file permissions within /usr/local/mysql, causing the error.

1 reply
Question marked as Top-ranking reply

Sep 26, 2017 1:51 PM in response to David Leip

In my case mysql failed after the update because the user running mysqld (The user mysql) being unable to open the mysql data directory with write permission. The files were instead owned by myself. I fixed this with:


sudo chown -R mysql /usr/local/mysql/*


The orignal cause (for me) was not the Sierra upgrade itelf, but the overall process of updating applications in response. Specifically other instructions online for updating PHP with brew after the Sierra update had included a chown:


sudo chown -R $(whoami):admin /usr/local # DO NOT DO THIS


This had unfortunately altered the file permissions within /usr/local/mysql, causing the error.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to repair mysql after Sierra Server Upgrade

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.