"$err" : "not authorized for query on admin.system.namespaces"
2013-04-05 14:34
826 查看
MongoDB中设置权限之后,如果再使用一般的命令都会报"$err" : "not authorized for query on admin.system.namespaces"这个错误,其意思就是没有权限,无法进行操作.则可以如下解决:
假设之前设置的用户为root,密码为admin
> use admin
switched to db admin
> db.addUser("root","admin")
{
"user" : "root",
"readOnly" : false,
"pwd" : "bde0d84f6749c235a6b4e36d945eb666",
"_id" : ObjectId("515e662430d89f61f6991c91")
}
> show collections
Fri Apr 05 13:50:36.685 JavaScript execution failed: error: {
"$err" : "not authorized for query on admin.system.namespaces",
"code" : 16550
} at src/mongo/shell/query.js:L128
>
说明:使用以上指令show collections的时候,发现报错了。是因为没有权限。做如下操作:
验证当前用户:
> db.auth("root","admin");
1
说明:返回1表示验证成功了,返回0表示验证失败。
此时,输入以下指令:show collections则可以看到admin下的集合了。
> show collections
system.indexes
system.users
假设之前设置的用户为root,密码为admin
> use admin
switched to db admin
> db.addUser("root","admin")
{
"user" : "root",
"readOnly" : false,
"pwd" : "bde0d84f6749c235a6b4e36d945eb666",
"_id" : ObjectId("515e662430d89f61f6991c91")
}
> show collections
Fri Apr 05 13:50:36.685 JavaScript execution failed: error: {
"$err" : "not authorized for query on admin.system.namespaces",
"code" : 16550
} at src/mongo/shell/query.js:L128
>
说明:使用以上指令show collections的时候,发现报错了。是因为没有权限。做如下操作:
验证当前用户:
> db.auth("root","admin");
1
说明:返回1表示验证成功了,返回0表示验证失败。
此时,输入以下指令:show collections则可以看到admin下的集合了。
> show collections
system.indexes
system.users
相关文章推荐
- Error creating index admin.system.version: 13 err: "not authorized to create index on admin.system.v
- mongodb 报错:Query failed with error code 13 and error message 'not authorized for query on ..."
- "This app is not allowed to query for scheme ***"
- Oracle study之--“ORA-00845: MEMORY_TARGET not supported on this system"错误
- "Could not preload class for phone policy: "
- "Copy" did not complete normally. Please see the log for more information
- "library not found for - "解决办法
- "无法启动Web服务器。Web服务器无法找到请求的资源" 或 "unable to start debugging on the web server.the web server could not find the request"解决方法
- "Format" did not complete normally. Please see the log for more information. 解决
- rh436 - Facing "Volume group for uuid not found" error while run lvcreate on shared storage
- Ios9.0 canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- <Error> <Server> <BEA-002606> <Unable to create a server socket for listening on channel "Default[2
- 【iOS开发】-canOpenURL: failed for URL: "xx" - error:"This app is not allowed to query for scheme xx"
- "Waiting for sound system to respond" problem, Ubuntu 10.04
- Fixing "The following VMware kernal modules have been found on your system that were not installed by the VMware installer."
- On Not "using System.Collections.Concurrent"
- "library not found for - "解决办法
- 解决"Could not reserve enough space for object heap"
- "library not found for - "解决办法
- "this class is not key value coding-compliant for the key ..."问题的解决