如何以当前用户身份而不是root用户身份启动mongodb社区



我已经根据以下内容安装了mongodb社区:https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/

出于某种原因,用于运行服务的权限被设置为"允许";根";而不是我的当前用户。这导致我无法启动服务。

~/Library/LaunchAgents 
❯ brew services ls                            
Name              Status      User          File
mongodb-community error  3584 root          ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

我需要更改哪些权限?

我已经验证了这些文件的权限是否设置为我的当前用户:

/usr/local/etc/mongod.conf
/usr/local/var/log/mongodb
/usr/local/var/mongodb

我还试着用launchangent:加载和卸载这个plist文件

homebrew.mxcl.mongodb-community.plist

plist文件(brew服务列表所指的(的权限似乎设置为我的当前用户:

~/Library/LaunchAgents 
❯ ls -la homebrew.mxcl.mongodb-community.plist
-rw-r--r--  1 <myusername>  staff  971 Aug 23 08:57 homebrew.mxcl.mongodb-community.plist

这就是解决方案:

> ls -l /tmp/mongodb-27017.sock
srwx------  1 root  wheel  0 Aug 22 14:41 /tmp/mongodb-27017.sock
> sudo rm -rf /tmp/mongodb-27017.sock
> brew services restart mongodb-community
> brew services list
Name              Status  User          File
mongodb-community started <username> ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist

最新更新