222

I can't start the mysql service in Snow Leopard, and in the panel prefs appears the message,

warning the user/local/mysql/data directory is not owned by the mysql user

How can I fix this?

0

2 Answers 2

348

If you can't start mysql service in snow leopard, and in the panel prefs appears 'warning the user/local/mysql/data directory is not owned by the mysql user', you have to:

  • sudo chown -RL root:mysql /usr/local/mysql
  • sudo chown -RL mysql:mysql /usr/local/mysql/data
  • sudo /usr/local/mysql/support-files/mysql.server start
11
  • 3
    Apparently this is still biting people - so I've moved your answer into an... Answer. Hope you don't mind...
    – Shog9
    Dec 17, 2014 at 1:55
  • 27
    for others coming to this now.. this works in El Capitan as well Oct 28, 2015 at 22:01
  • Why hasn't this been checked as the correct answer? Nov 3, 2015 at 16:36
  • 9
    This randomly started happening to me on Sierra (weeks after updating). Fix still works
    – lewis
    Nov 17, 2016 at 4:13
  • 4
    Tried this on macOS Mojave and no joy. I get ERROR! The server quit without updating PID file when trying mysql.server start Nov 14, 2018 at 16:25
118

This work for me in El Capitan & Sierra

sudo chown -R _mysql:wheel /usr/local/mysql/data

That's it.


Update: to fix auto start

I found it more useful if you fix Auto Starting too:

sudo nano /Library/LaunchDaemons/com.mysql.mysql.plist

And paste in:

<!--?xml version="1.0" encoding="UTF-8"?-->
<plist version="1.0">
  <dict>
    <key>KeepAlive</key>
    <true />
    <key>Label</key>
    <string>com.mysql.mysqld</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/local/mysql/bin/mysqld_safe</string>
      <string>--user=mysql</string>
    </array>        
  </dict>
</plist>

Save it and then:

sudo chown root:wheel /Library/LaunchDaemons/com.mysql.mysql.plist
sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysql.plist
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist

Then it will load on a restart.

Reference: https://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/

5
  • 2
    is wheel your own user name, or something special? If that could be clarified that would be great Feb 22, 2016 at 13:58
  • Wheel is (Unix term) refers to a user account with a wheel bit. Mar 2, 2016 at 22:08
  • 3
    This fixed it in Sierra, as well.
    – saq7
    Nov 4, 2016 at 18:29
  • 1
    What is a 'wheel bit' ?
    – Nick Lee
    Mar 16, 2019 at 19:42
  • 'Wheel bit' is a system setting that provides additional special system privileges that empower a user to execute restricted commands that ordinary user accounts cannot access. Apr 10, 2019 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.