MongoDB Default Port – 27017

When a MongoDB Server instance is started on a machine, it has to start listening on a port. By default, port number 27017 is used to mongod and mongos instances.

In this tutorial, we shall learn how to change this default port.

Change MonogDB Port

Sometimes, we may require to start MongoDB Server instance on a different port. The reason could be any.

In that case, we can change the default MongoDB Port Number while starting Mongo Daemon by passing –port option as shown below.

</>
Copy
 C:\>"C:\Program Files\MongoDB\Server\4.0\bin\mongod.exe" --port 27052
Change Default MongoDB Port

Conclusion

In this MongoDB Tutorial, we have learnt what the default port is for MongoDB Server instance, and also how to change this default port.