mongodb Access control is not enabled for the database 无访问控制解决方案
转载:https://blog.csdn.net/q1056843325/article/details/70941697
今天使用MongoDB时遇到了一些问题
建立数据库连接时出现了warnings
出现这个警告的原因是新版本的MongDB为了让我们创建一个安全的数据库
必须要进行验证
后来在外网找到了答案
解决方案如下:
创建管理员
use admin
db.createUser(
{
user: "userAdmin", //用户名
pwd: "123", //密码
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] //权限
}
)
重启MongoDB服务器
mongod --auth --port 27017 --dbpath <关联路径>
1
(端口默认就是27017可以不指定)

终端最后输出"[initandlisten] waiting for connections on port 27017",
启动完成
连接并认证
mongo --port 27017 -u "userAdmin" -p "123" --authenticationDatabase "admin"
1
添加额外权限用户
use test
db.createUser(
{
user: "tester",
pwd: "123",
roles: [ { role: "readWrite", db: "test" },
{ role: "read", db: "reporting" } ]
}
)
mongo --port 27017 -u "myTester" -p "xyz123" --authenticationDatabase "test"
MongoDB更新了,使用mongoose也不能简单的建立连接了
必须要添加必要参数
var mongoose = require('mongoose');
var db = mongoose.createConnection('localhost', 'test', 27017, {user: 'tester', pass: '123'});
mongodb Access control is not enabled for the database 无访问控制解决方案的更多相关文章
- [转] Node.js使用MongoDB3.4+Access control is not enabled for the database解决方案
今天使用MongoDB时遇到了一些问题 建立数据库连接时出现了warnings 出现这个警告的原因是新版本的MongDB为了让我们创建一个安全的数据库 必须要进行验证 后来在外网找到了答案 解决方案如 ...
- mongo11---Access control is not enabled for the database
今天使用MongoDB时遇到了一些问题 建立数据库连接时出现了warnings 出现这个警告的原因是新版本的MongDB为了让我们创建一个安全的数据库 必须要进行验证 后来在外网找到了答案 解决方案如 ...
- Oracle Applications Multiple Organizations Access Control for Custom Code
档 ID 420787.1 White Paper Oracle Applications Multiple Organizations Access Control for Custom Code ...
- 【MongoDB】The Access control of mongodb
In this blog we mainly talk about the access control including limitation of ip, setting listen port ...
- 转:Oracle R12 多组织访问的控制 - MOAC(Multi-Org Access Control)
什么是MOAC MOAC(Multi-Org Access Control)为多组织访问控制,是Oracle EBS R12的重要新功能,它可以实现在一个Responsibility下对多个Opera ...
- Oracle R12 多组织访问的控制 - MOAC(Multi-Org Access Control)
什么是MOAC MOAC(Multi-Org Access Control)为多组织访问控制,是Oracle EBS R12的重要新功能,它可以实现在一个Responsibility下对多个Opera ...
- Browser security standards via access control
A computing system is operable to contain a security module within an operating system. This securit ...
- Enabling granular discretionary access control for data stored in a cloud computing environment
Enabling discretionary data access control in a cloud computing environment can begin with the obtai ...
- Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' heade
XMLHttpRequest cannot load http://10.164.153.37:8050/WebService/WebService.asmx/wsGetStreetData. Res ...
随机推荐
- C# 与 C++,语法差别有多小-第二章 C++浏览
(一)动态内存分配和指针 C++:new 和 delete int *arr = new int[ 4 ]; C#:只有new,de ...
- 高级Javascript代码
Javascript是一门很吊的语言,我可能学了假的JavaScript,哈哈,大家还有什么推荐的,补充送那啥邀请码. 本文秉承着:你看不懂是你SB,我写的代码就要牛逼. 1.单行写一个评级组件 &q ...
- innobackupex对MySQL做热备份,报错mysql库下数据字典表损坏
[root@node1 op]#mysql -Vmysql Ver 14.14 Distrib 5.6.29innobackupex热备份MySQL报错,报错信息:[root@node1 op]#in ...
- Windows 10 Shell命令
可以在[win+R] run 窗口 和 explorer窗口中使用 在command prompt中使用: C:\Users\a>explorer shell:sendto “ shell:Ac ...
- 术语-BLOB:BLOB
ylbtech-术语-Blob:Blob 计算机视觉中的Blob是指图像中的一块连通区域,Blob分析就是对前景/背景分离后的二值图像,进行连通域提取和标记.标记完成的每一个Blob都代表一个前景目标 ...
- JS-线程、事件循环、任务队列
JS 是单线程的,但是却能执行异步任务,这主要是因为 JS 中存在事件循环(Event Loop)和任务队列(Task Queue). 事件循环: JS 会创建一个类似于 while (true) 的 ...
- mybatis有结果返回null
解决:application.yml 中mybatis此项(解决驼峰及数据库字段有下划线问题) map-underscore-to-camel-case: true 问题: mybatis debug ...
- Jmeter 循环控制器 遍历结果
1.测试计划,添加Mysql jar包 2.线程组 3.JDBC Connection Configuration,配置Mysql 4.添加JDBC Request,将查询出的数据对应的存入usern ...
- 高德WMTS规则
新版 http://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1& ...
- Mac001--JDK安装与配置JDK环境变量
Mac--安装JDK 一.Java6安装 官方下载下载地址:http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-a ...