当前位置:网站首页>Mongodb compass connects to the Alibaba cloud remote server database or reports an error occurred while loading instance info: command hostinfo req
Mongodb compass connects to the Alibaba cloud remote server database or reports an error occurred while loading instance info: command hostinfo req
2022-06-13 04:14:00 【Day t】
When you connect to the remote server, the following error is reported :
An error occurred while loading instance info: command hostInfo requires authentication
command create requires authentication
Authentication failed.
It may be that your database is still empty , There is no administrator in it , So just use compass The connection will report an error
Pagoda panel installation mongo4.0 After that, you need to set the account and password to use the database

After installation authorization: disabled When configured by default 

SSH terminal
1、 Get into mongodb The installation directory , The following is the default directory of the pagoda panel
cd /www/server/mongodb/bin
2、 Get into mongodb Environmental Science And switch to admin database
mongo
use admin
3、 Look at the current users
show users
4、 Create an administrator account
db.createUser({
user: "admin", pwd: "password", roles: [{
role: "userAdminAnyDatabase", db: "admin" }] })

mongodb Users in are identity based role Of , Of the administrator account role yes userAdminAnyDatabase.admin The user is used to manage the account , You cannot close the database .
5、 establish root account number
db.createUser({
user: "root",pwd: "password", roles: [ {
role: "root", db: "admin" } ]})

Super administrator root. role :root.root The role is used to close the database .
6、 Create the management role of the user's own database
use yourdatabase// This is your database name , at will
db.createUser({
user: "user",pwd: "password",roles: [ {
role: "dbOwner", db: "yourdatabase" } ]})

role: "dbOwner" Represents the database owner role , Have the highest permissions on the database . For example, create a new index , Be an account administrator and super administrator , You can create users for your own database .
It must be this time , Be sure to switch to the database to create users , Otherwise, the created user still belongs to admin.
If it's a reading and writing role , Permission set to role: “readWrite”.
7、 To view the user
show users
Here is the current database Look at other databases use yourdatabase
8、 Delete user
To delete a user, the account administrator must delete , therefore , Switch to admin role
use admin
db.auth("admin","password")
Delete individual users
db.system.users.remove({
user:"XXXXXX"})
Delete all users
db.system.users.remove({
})
9、 Modify configuration item authorization: enabled Authorize remote login 
At this time, the database item cannot be opened ,SSH Terminal re-entry mongodb Environmental Science There will be an error when setting the account and password .
If you need to enter again , Be sure to change this configuration to disabled And restart the service
10、 Configure ports and servers IP

0.0.0.0 Means unrestricted ip, In this way, the php have access to 127.0.0.1 Connect , Intranet can be used in other places ip Or public network ip visit .
11、MongoDB Compass



You can connect successfully
边栏推荐
- Use ASE encryption and decryption cache encapsulation in Vue project
- Introduction to RFM analysis
- Discussion sur la modélisation de la série 143
- The could not find com scwang. smart:refresh-layout-kernel:2.0.3. Required by: project: the app cannot load the third-party package
- ROS topics and nodes
- JS common array methods
- leetcode.1 --- 两数之和
- 1.4.2 Capital Market Theroy
- [Yugong series] June 2022 Net architecture class 080 master cluster and database switching of distributed middleware schedulemaster
- Uni app enables pull-up loading and pull-down refresh (pull-down with animation)
猜你喜欢

MCU: NEC protocol infrared remote controller

干预分析 + 伪回归

1.4.2 Capital Market Theroy

Lightweight digital mall system based on PHP

knife4j aggregation 2.0.9支持路由文档自动刷新

史上最详细的Swin-Transformer 掩码机制(mask of window attentation)————shaoshuai

单片机:A/D 和 D/A 的基本概念

Google Chrome browser reports an error: net:: err_ BLOCKED_ BY_ CLIENT

EGO planner论文翻译

120. triangle minimum path sum - Dynamic Planning
随机推荐
leetcode.1 --- 两数之和
十亿数据量 判断元素是否存在
How can a sweeping robot avoid obstacles without "mental retardation"? Analysis of five mainstream obstacle avoidance techniques
重读经典:《End-to-End Object Detection with Transformers》
dumi 搭建文档型博客
7-289 tag count (300 points)
Reread the classic: end to end object detection with transformers
Talking about the wavelength of laser radar
Dumi construit un blog documentaire
Redis-HyperLogLog-基数统计算法
Milliards de données pour déterminer si un élément existe
Lambda termination operation find and match nonematch
[MySQL] index and transaction
Advanced Mathematics (Seventh Edition) Tongji University exercises 1-2 personal solutions
Single chip microcomputer: MODBUS multi computer communication program design
Redis数据持久化
Single chip microcomputer: a/d differential input signal
MCU: EEPROM multi byte read / write operation sequence
Real time requirements for 5g China Unicom repeater network management protocol
十億數據量 判斷元素是否存在