简体   繁体   English

mongo db 没有在 centOS 7 上创建超级用户?

[英]mongo db is not creating super user on centOS 7?

I have installed mongodb on centOS 7. I can access the mongodb with command mongo here are my shell commands:我已经在 centOS 7 上安装了 mongodb。我可以使用命令 mongo 访问 mongodb,这里是我的 shell 命令:

$ mongo
MongoDB shell version: 3.2.19
connecting to: test
Server has startup warnings:
2018-02-27T06:49:14.392+0500 I CONTROL  [initandlisten]
2018-02-27T06:49:14.393+0500 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.

> use admin;
switched to db admin

> db.createUser( { user: "tr1", pwd: "123123", roles: [ "userAdminAnyDatabase" ] } );
2018-02-27T07:06:29.833+0500 E QUERY    [thread1] Error: couldn't add user: No role named userAdminAnyDatabase@qsu_mweb_institution_1 :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1267:15
@(shell):1:1

When I try to create a user with some admin role it is giving strange error.当我尝试创建具有某些管理员角色的用户时,它给出了奇怪的错误。

Can anybody help what is wrong ?有人可以帮忙解决什么问题吗? I am stuck.我被困住了。

You need to reinstall mongodb with:您需要使用以下命令重新安装 mongodb:

sudo yum install mongodb-org

It will update missing things.它会更新丢失的东西。 Then try然后试试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM