警告 user/local/mysql/data 目录不属于 mysql 用户

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5527676/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 19:23:36  来源:igfitidea点击:

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

mysqlmacos

提问by Kronos

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

我无法在雪豹中启动 mysql 服务,并且在面板首选项中出现消息,

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

警告 user/local/mysql/data 目录不属于 mysql 用户

How can I fix this?

我怎样才能解决这个问题?

回答by Kronos

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:

如果在snow leopard中无法启动mysql服务,并且在面板prefs中出现'warning the user/local/mysql/data directory is not allowed by the mysql user',则必须:

  • 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
  • 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

回答by Ihab Shoully

This work for me in El Capitan& Sierra

这在El CapitanSierra 中为我工作

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/

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