title: Not able to connect mongodb by terminal using authentication data
body: <p>Mongo version 5.0.2.
  Ubuntu 20.0</p>
  <p>I have enabled security for MongoDB connection in my local host.
  I am trying to connect my localhost MongoDB using authentication details by below commands</p>
  <p><code>mongo admin -u ADMIN_1234 -p &quot;PASSWORD_1234&quot; -host localhost:27017</code></p>
  <p><code>mongo admin -u ADMIN_1234 -p &quot;PASSWORD_1234&quot; -host 127.0.0.1:27017</code></p>
  <p><code>mongo admin -u ADMIN_1234 -p &quot;PASSWORD_1234&quot;</code></p>
  <p><code>mongo admin -u ADMIN_1234 -p PASSWORD_1234 -host localhost:27017</code></p>
  <p><code>mongo admin -u ADMIN_1234 -p PASSWORD_1234 -host 127.0.0.1:27017</code></p>
  <p><code>mongo admin -u ADMIN_1234 -p PASSWORD_1234</code></p>
  <p>but below error, I am getting for all the above commands. not able to connect to mongodb</p>
  <pre><code>connecting to: mongodb://localhost:27017/admin?compressors=disabled&amp;gssapiServiceName=mongodb
  Error: couldn't connect to server localhost:27017, connection attempt failed: SocketException: Error connecting to localhost:27017 (127.0.0.1:27017) :: caused by :: Connection refused :
  connect@src/mongo/shell/mongo.js:372:17
  @(connect):2:6
  exception: connect failed
  exiting with code 1
  </code></pre>