Can't connect to MongoDB with authentication enabled

前端 未结 2 382
花落未央
花落未央 2021-01-06 06:57

I\'m running the latest MongoDB for Ubuntu 14.04

  • I have created a user named \"admin\" with \"userAdminAnyDatabase\" role
  • I can access databases local
2条回答
  •  一生所求
    2021-01-06 07:16

    I think that auth = true is an invalid configuration and your mongod is not starting because of it. To enable authorization, try using the following instead:

    security:
      authorization: enabled
    

    Then, to connect to the database, make sure that your client is using the correct authentication database and authentication mechanism. This can be done using the commmand line by the following command:

    mongo localhost -u admin -p myAdminPass --authenticationDatabase admin --authenticationMechanism SCRAM-SHA-1
    

提交回复
热议问题