今天使用MongoDB时遇到了一些问题

建立数据库连接时出现了warnings

出现这个警告的原因是新版本的MongDB为了让我们创建一个安全的数据库 
必须要进行验证 
后来在外网找到了答案

解决方案如下:

创建管理员

use admin
db.createUser(
{
user: "userAdmin", //用户名
pwd: "123", //密码
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] //权限
}
)

重启MongoDB服务器

mongod --auth --port 27017 --dbpath <关联路径>

(端口默认就是27017可以不指定) 

终端最后输出"[initandlisten] waiting for connections on port 27017"
启动完成

连接并认证

mongo --port 27017 -u "userAdmin" -p "123" --authenticationDatabase "admin"

添加额外权限用户

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'});

==主页传送门==

mongo11---Access control is not enabled for the database的更多相关文章

  1. [转] Node.js使用MongoDB3.4+Access control is not enabled for the database解决方案

    今天使用MongoDB时遇到了一些问题 建立数据库连接时出现了warnings 出现这个警告的原因是新版本的MongDB为了让我们创建一个安全的数据库 必须要进行验证 后来在外网找到了答案 解决方案如 ...

  2. mongodb Access control is not enabled for the database 无访问控制解决方案

    转载:https://blog.csdn.net/q1056843325/article/details/70941697 今天使用MongoDB时遇到了一些问题 建立数据库连接时出现了warning ...

  3. Oracle Applications Multiple Organizations Access Control for Custom Code

    档 ID 420787.1 White Paper Oracle Applications Multiple Organizations Access Control for Custom Code ...

  4. 转:Oracle R12 多组织访问的控制 - MOAC(Multi-Org Access Control)

    什么是MOAC MOAC(Multi-Org Access Control)为多组织访问控制,是Oracle EBS R12的重要新功能,它可以实现在一个Responsibility下对多个Opera ...

  5. Oracle R12 多组织访问的控制 - MOAC(Multi-Org Access Control)

    什么是MOAC MOAC(Multi-Org Access Control)为多组织访问控制,是Oracle EBS R12的重要新功能,它可以实现在一个Responsibility下对多个Opera ...

  6. Browser security standards via access control

    A computing system is operable to contain a security module within an operating system. This securit ...

  7. 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 ...

  8. 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 ...

  9. Windows Azure Virtual Network (10) 使用Azure Access Control List(ACL)设置客户端访问权限

    <Windows Azure Platform 系列文章目录> 本文介绍的是国内由世纪互联运维的China Azure. 我们在创建完Windows Azure Virtual Machi ...

随机推荐

  1. 【UVA 1636】 (条件概率)

    题链:https://cn.vjudge.net/problem/UVA-1636 题意 给出一把枪的子弹序列,已知开了一枪且无子弹,问下一步的决策是旋转,还是开下一枪 题解 已知开一枪没子弹,下一枪 ...

  2. Fiddler抓包-get与post请求

    from:https://www.cnblogs.com/yoyoketang/p/6719717.html 本篇以博客园的请求为例,简单分析get与post数据有何不一样,以后也能分辨出哪些是get ...

  3. mysql异常Incorrect string value: '\xE6\xB5\x8B\xE8\xAF\x95' for column 'region_name'

    Incorrect string value: '\xE6\xB5\x8B\xE8\xAF\x95' for column 'region_name' insert语句加的该字段有汉字,乱码造成的 解 ...

  4. JIRA 6.3.6安装

    一:下载JIRA 从官网下载:https://www.atlassian.com/software/jira/download 我下载的版本是Linux版的 JIRA 6.3.6 wget http: ...

  5. spoj 839 最小割+二进制

    #include<stdio.h> #include<string.h> #include<queue> using namespace std; #define ...

  6. C语言一些常见的操作字符串方法

    // 首字母大写 ;(c=string[i])!='\0';i++) // 字符串碰到\0结束 C知识 { if (c==' ') { printf("%c",c), word=; ...

  7. Codevs 队列练习 合并版

    3185 队列练习 1  时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题目描述 Description 给定一个队列(初始为空),只有两种操作入队和出队,现给出这 ...

  8. 指针与数组的对比(——选自:C++内存管理技术内幕)

    数组: 数组要么是在静态存储区上创建(如全局数组),要么是在栈上创建的.数组名代表着 段连续的内存,其地址和容量在生命周期内是不会改变的,而只能改变其数组内容. 指针: 指针是一种指针类型的变量,变量 ...

  9. Bootstrap3 为何无法显示Glyphicons 图标

    Bootstrap3 为何无法显示Glyphicons 图标 在CSS引入字体即可解决 @font-face { font-family: 'Glyphicons Halflings'; src: u ...

  10. Apache 文件根目录设置修改方法 (Document Root)

    最近在学习WordPress,使用appServ 在windows上搭建Php开发环境 在网上查找到的关于修改Apache服务器根目录的资料,对比学习,再此记录 在安装 Apache 时,系统会给定一 ...