简体   繁体   中英

Cannot start Mysql on Mac

I'am not able to get Mysql running after installation using Brew. I'am using OS X El Capitan Version 10.11.3 and Mysql Server version 5.7.11. When I start the server I receive:

Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/var/mysql/Hedis-MacBook-Pro.local.pid).

and this what I get in my err file:

2016-03-19T20:59:45.907542Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable

Does any one have got this before ? Many thanks.

I received this same error after updating homebrew.

To fix this I had to reset the owner of the mysql data dir, it was changed back to my userid after the update.

cd /usr/local/mysql
sudo chown -R _mysql data/

Assuming your mysql home dir is in /usr/local

After this a restart of the service worked

$ sudo /usr/local/mysql/support-files/mysql.server start
Starting MySQL
. SUCCESS! 

Brew now install mysql data to this folde: /usr/local/var/mysql/

I fixed the issue with the following:

cd /usr/local/var/mysql/

Make sure all files/folder under the above directory are owned by the right user and group. In my case, the user is me, za.

drwxr-x---   77 za   admin      2618 Jun 29  2016 mysql/
-rw-rw----    1 za   admin         5 Mar 13 11:03 mysqld_safe.pid
drwxr-x---   90 za   admin      3060 Jun 29  2016 performance_schema/
-rw-------    1 za   admin      1676 Jun 29  2016 private_key.pem
-rw-r--r--    1 za   admin       452 Jun 29  2016 public_key.pem
-rw-r--r--    1 za   admin      1079 Jun 29  2016 server-cert.pem
-rw-------    1 za   admin      1680 Jun 29  2016 server-key.pem
drwxr-x---  108 za   admin      3672 Jun 29  2016 sys/
-rw-r-----  1 _mysql  admin      3672 Jun 29  2016 somehostname.xyz.org.err 

The issue was that, this file (somehostname.xyz.org.err) was owned by _mysql, admin.

I deleted that one file and boom, mysql started successfully.

rm somehostname.xyz.org.err


  za$ /usr/local/Cellar/mysql/5.7.22/bin/mysql.server start
Starting MySQL
 SUCCESS! 

za$ /usr/local/Cellar/mysql/5.7.22/bin/mysql.server status
 SUCCESS! MySQL running (7625)

za$ /usr/local/Cellar/mysql/5.7.22/bin/mysql.server stop  
Shutting down MySQL
.. SUCCESS! 

In a different scenario, you may just need to alter ownership/permissions and not delete. Deleted mine because it is a file that will be re-created upon re-runing the service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM