MySQL 本地所有者和权限
我在 MySQL 论坛上问了这个问题,但没有得到答案,所以我在这里尝试一下。
我最近在 MacBook Pro 的 /usr/local
目录中成功安装了 64 位版本的 mysql-5.5.8。
为了解决一个完全不相关的软件(实际上是RVM),我将我的/usr/local
目录chown-ed到$USER
,这让MySQL不高兴。它特别抱怨 /usr/local/mysql/data
目录,因此我将该目录 chown-ed 到 _mysql:wheel
。
一切似乎又恢复正常了,但这让我想知道,如果更改整个 /usr/local/mysql
目录的所有者,而不仅仅是数据,是否会更好子目录。
由于我忽略了记录默认安装运行的所有者,有人可以告诉我 /usr/local/mysql
目录默认的所有者和权限吗(如果您不无意中搞砸了) ? :-/
我猜 rwxr-xr-x
适合权限(这就是数据目录当前所拥有的,并且看起来工作正常),但如果能加强这种预感,我们将不胜感激。
I asked this question on the MySQL forums and got no answer, so I'll try here.
I recently successfully installed the 64 bit version of mysql-5.5.8 on a MacBook Pro in the /usr/local
directory.
To address a completely unrelated software (RVM actually) , I chown-ed my /usr/local
directory to $USER
, Which made MySQL unhappy. It complained specifically about the /usr/local/mysql/data
directory, so I chown-ed that directory to _mysql:wheel
.
Everything appears to work again, but it made me wonder if I would have been better off changing the owner of the whole /usr/local/mysql
directory, not just the data sub-directory.
Since I neglected to make notes of what owner the default installation runs under, could someone tell me what owner and permissions the /usr/local/mysql
directory is by default if you don't inadvertently screw it up?
:-/
I'm guessing rwxr-xr-x
would be appropriate for permissions (that's what the data directory currently has and it appears to be working fine), but reinforcement for that hunch would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了类似的问题,在纠正 /user/local 的权限问题时,我无法再看到任何数据库。
这修复了它:
返回了
然后我更改为 mysql 根目录并重置所有权:
重新启动 mysql 后,我的数据库又回来了。
文档:
https://dev.mysql.com/doc/refman /5.6/en/data-directory-initialization.html
I had a similar problem where, in correcting a permissions issue with /user/local, I was no longer able to see any of my databases.
This fixed it:
Which returned
I then changed into the root mysql directory and reset the ownership:
After restarting mysql, my databases were back.
Documentation:
https://dev.mysql.com/doc/refman/5.6/en/data-directory-initialization.html
我没有 Mac,也从未使用过,但我可以给你一些提示。
在配置文件
my.cnf
中,您可以在[mysqld]
部分找到这样的行:它应该为您提供有关服务器用户名的信息,并且这些用户应该是所有数据的所有者文件。
如果您需要其他用户访问该文件,您可以使用 SGID。简而言之,它允许您在用户之间设置一些公共组,并允许您创建具有适当权限的文件。
有关更多信息,您可以在这里找到: http://www.library.yale .edu/wsg/docs/permissions/sgid.htm。
I don't have Mac and never use one but I can give you some hints.
In the config file
my.cnf
you can find such line in section[mysqld]
:It should give you information about server user name and these user should be owner of all data files.
If you need some other user have access to that files you can use SGID. In short it allows you to setup some common groups between users and allows you to create files with proper permissions.
More about that you can find here: http://www.library.yale.edu/wsg/docs/permissions/sgid.htm.