运行:~ sudo vi /etc/mongod.conf 添加下列认证代码
security:
authorization:'enabled'
运行:~ sudo service mongod restart 重启mongodb数据库服务失败
提示:
MongoDB shell version v3.4.6
connecting to: mongodb://127.0.0.1:19999/
2017-07-10T21:13:03.552+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:19999, in(checking socket for error after poll), reason: Connection refused
2017-07-10T21:13:03.552+0800 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:19999, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed
请问Scott老师,这是什么原因?我如果退回原mongod.conf文件内容,再重启mongod服务就没问题,到底开启用户权限要怎样弄?