When creating first admin user on mongdb cluster getting error “couldn't add user: not authorized on admin to execute command”

后端 未结 6 881
既然无缘
既然无缘 2021-02-04 19:10

I am using mongoDB Cluster with version 3.4 in google cloud compute engine, actually past week my database got attacked by hackers that\'s why i thought about using authorizatio

6条回答
  •  死守一世寂寞
    2021-02-04 20:14

    When a new database is setup with authorisation/security enabled but no users set up, you can only connect to it from the localhost. In your config file you should have bind ip set to 127.0.0.1 I think in order to make sure you connect to it with the correct authorisation to create new users.

    This is what it says in Mongo course M103

    By default, a mongod that enforces authentication but has no configured users only allows connections through the localhost.

提交回复
热议问题