macos – Warning the user/local/mysql/data directory is not owned by the mysql user

The Question :

215 people think this question is useful

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?

The Question Comments :
  • Thank you. Whether it’s a question or not, it solved the issue for me.
  • I had the same problem in Mountain Lion, this worked for me.
  • Who cares if it’s not a question. It worked. +10000000 points.
  • This solved my problem, but I think it’s a disgrace that @Kronos tried to use SO to be helpful in the wrong format. An absolute disgrace. This blatant disregard for the Q&A format could permanently destabilise this community. To the administrators who closed this thread: keep fighting the good fight. I believe in you.
  • +1 as it worked for me. I do agree with both Chris and callum at the same time. As the article that Chris pointed out, it IS okay to answer your own QUESTION. The point is here there is no question to answer, just the answer. It would’ve been better if he would’ve asked the question, then answered it.

The Answer 1

334 people think this answer is useful

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

The Answer 2

113 people think this answer is useful

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/

Tags:,

Add a Comment