Hi Chris,
Thank you so much for your response , even i am trying to check the admin database to get further information about the password which we set earlier because what ever password we have set it up that is not working . below script we ran to create the database.
[root@****** bin]# cat /tmp/db-create.js
// switch to database
db = db.getSiblingDB('Bibhu');
// firstly we have to clean up potential remainders
db.dropAllRoles();
db.dropAllUsers();
db.dropDatabase();
// create admin user
db.createUser({
user: 'admin',
pwd: 'Loginto@020',
roles: [{ role: 'dbOwner', db:'Bibhu'}]
});
// create collection
db.createCollection('adHocCollection')
// insert documents
db.runCommand(
{
insert: "adHocCollection",
documents: [
{ ingredient: "potatoes", origin: "Switzerland" },
{ ingredient: "beef", origin: "Argentina" },
{ ingredient: "mozzarella", origin: "Italy" }
],
ordered: true,
writeConcern: { w: "majority", wtimeout: 5000 }
}
)
I have created the Database as “Bibhu” but when i am trying to connect using same password which i setup that is not working. so trying to connect Mongo shell so that will connect the admin database but i am getting below error while trying to connect Mongo shell
[root@******* bin]# mongo
MongoDB shell version v3.6.5
connecting to: mongodb://127.0.0.1:27017
2020-08-23T07:22:12.802+0200 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2020-08-23T07:22:12.802+0200 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed
I have tried to check whether Mongod is working fine or not but its working fine as mentioned the status below.
[root@******* ~]# systemctl status mongod-inst00.service
● mongod-inst00.service - High-performance, schema-free document-oriented database
Loaded: loaded (/usr/lib/systemd/system/mongod-inst00.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2020-08-18 04:45:40 CEST; 5 days ago
Docs: https://docs.mongodb.org/manual
Main PID: 2222 (mongod)
CGroup: /system.slice/mongod-inst00.service
└─2222 /usr/bin/mongod -f /etc/mongod-inst00.conf
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
Could you please suggest , as i am new to the current environment so facing problem in each step. Sorry to ask all the details.