Unable to access mongo terminal

November 4, 2019 263 views
Ubuntu 18.04 MongoDB
root@Wavynn-master:~# sudo service mongod start
root@Wavynn-master:~# mongo
MongoDB shell version v4.2.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2019-11-04T18:18:00.829+0000 E  QUERY    [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2019-11-04T18:18:00.830+0000 F  -        [main] exception: connect failed
2019-11-04T18:18:00.830+0000 E  -        [main] exiting with code 1

Hello. I have been attempting to pair my mongoDB with compass, compass asked for a authentication database, in which I used a tutorial, where I created a db called admin, and an admin role having all permissions to all databases.

This can be seen here

use admin;
switched to db admin
> db.createUser({
... user: "admin",
... pwd: "*********",
... roles: [
... {role: "userAdminAnyDatabase", db: "admin" },
... {role: "readWriteAnyDatabase", db: "admin" },
... {role: "dbAdminAnyDatabase", db: "admin" }
... ]
... });
Successfully added user: {
        "user" : "admin",
        "roles" : [
                {
                        "role" : "userAdminAnyDatabase",
                        "db" : "admin"
                },
                {
                        "role" : "readWriteAnyDatabase",
                        "db" : "admin"
                },
                {
                        "role" : "dbAdminAnyDatabase",
                        "db" : "admin"
                }
        ]
}

Right after this issue started occuring.

Anyone have any suggestions as to how we fix this issue? Also a tip towards how we connect compass with mongoDB on ubuntu :)

Be the first one to answer this question.