errmsg" : "not authorized on book to execute command
来源:互联网 发布:淘宝怎么装修模板 编辑:程序博客网 时间:2024/04/30 23:27
接上一篇博客,安装好了mongodb,然后进行建库,插入数据,更新数据等一系列操作
上篇文章的链接:http://blog.csdn.net/sizhezhongnian/article/details/74002537
建数据库
use xxx
当有xxx库的时候,则不创建新的,当没有xxx的时候,自动创建xxx数据库
use book
新增数据
db.book.insert({"name":"cjn","age":24,"sex":"男"});
当执行时,出错
此时
MongoDB进行操作时,出现errmsg" : "not authorized on test to execute command { listCollections: 1.0 }这个提示
表示没有权限,那就赶紧添加用户吧
切换到admin库
use admin;
添加用户
db.createUser( {
user: "sa",
pwd: "sa",
roles: [ { role: "root", db: "admin" } ]
});
既然已经添加了用户
用sa账号登录
db.auth('sa','sa');
然后在
db.book.insert({"name":"cjn","age":24,"sex":"男"});
成功!
阅读全文
0 0
- errmsg" : "not authorized on book to execute command
- splitVector "errmsg" : "not authorized on test to execute command
- errmsg" : "not authorized on test to execute command { listCollections: 1.0 }mo
- "errmsg" : "not authorized on admin to execute command { $eval: \"return 1111\" }"
- not authorized on local to execute command
- not authorized on test to execute command { $eval: \"return 1111\"
- MongoDB not authorized on admin to execute command --auth Authentication failed.
- [MongoDB] not authorized on test to execute command-MongoDB的权限配置
- pymongo.errors.OperationFailure: not authorized on test to execute command { listCollections: 1, cur
- ant resolve时碰到如下错误a module is not authorized to depend on itself
- MongoDB中的数据导出为JSON文件时报错“Failed: not authorized on XXX to...”
- Execute history command on Linux
- error: internal error: unable to execute QEMU command 'migrate': this feature or command is not cur
- asmcmd not execute cp command
- could not execute batch command
- you are not authorized to use service
- execute command denied to user...
- Error creating index admin.system.version: 13 err: "not authorized to create index on admin.system.v
- windows10+matlab2014a+faster-rcnn
- Angular js 初始
- 我的敏捷学习计划
- bzoj 4297 Rozstaw szyn 思维 dfs
- Tomcat --> Cannot create a server using the selected type(Eclipse添加tomcat 6失败)
- errmsg" : "not authorized on book to execute command
- 微信 Android 模块化架构重构实践
- playfair密码
- 音视频同步(播放)原理
- 微信小程序商店:极乐小程序商店推荐之601~700
- Mac 10.11.4 opengl开发环境配置
- bzoj 1010: [HNOI2008]玩具装箱toy(斜率dp)
- LeetCode53. Maximum Subarray一种很好的做法
- picasso 源码解析