MongoDB 认证鉴权那点事(3)

更多操作

六、常见问题 shell 操作提示错误 use appdb MongoDB Enterprise > db.stats() { "ok" : 0, "errmsg" : "not authorized on appdb to execute command { dbstats: 1.0, scale: undefined }", "code" : 13 }

原因:当前连接未鉴权或用户没有操作权限 解决:为用户分配适当权限,并执行auth操作,如下:

db.auth('appuser','yourpassword'); 无法执行 eval 操作

db.eval() 是一个全局操作,可执行任意数据库脚本; 执行该命令需要拥有anyAction或anyResource的权限,通常不建议为数据库用户赋予这样的权限。 该命令存在安全风险,已不建议使用(mongodb 3.0之后已经过期)。

七、扩展阅读

Mongodb 鉴权机制 https://docs.mongodb.com/manual/core/authentication/

Mongodb 内置角色介绍

Mongodb 权限操作介绍

更多MongoDB相关教程见以下内容

MongoDB文档、集合、数据库简介 

MongoDB 3分片部署及故障模拟验证 

Linux CentOS 6.5 yum安装MongoDB 

CentOS 7 yum方式快速安装MongoDB 

MongoDB的查询操作 

在 Azure 虚拟机上快速搭建 MongoDB 集群 

MongoDB复制集原理 

MongoDB 3.4 远程连接认证失败 

Ubuntu 16.04中安装MongoDB3.4数据库系统 

MongoDB权威指南第2版PDF完整带书签目录 下载见

MongoDB 的详细介绍请点这里
MongoDB 的下载地址请点这里

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/9c122ccc12d63b162ae5cee604389e45.html