C:\Program Files\MongoDB\Server\4.4\bin>mongod --port 27017 --dbpath

I am trying to re-set my username and password by following this tutorial:

O/S: Windows 10
however, i can’t restart the MongoDB instance as advised here:
https://docs.mongodb.com/manual/tutorial/enable-authentication/

Do I need to restart all over again from C:\ ?

What issue are you facing when starting mongod?
Please show full command you used
Make sure dbpath dir exists and no other mongod running on the same port

Hi Ramachandra,

My latest issue is I can’t get SpringBoot to recognise the uri in application.properties

spring.data.mongodb.uri=mongodb://root:rootpassword@localhost:27017/testdb
spring.data.mongodb.authentication-database=admin
spring.data.mongodb.username=myUserAdmin
spring.data.mongodb.password=abc123

Below is the command I have entered:

C:\Program Files\MongoDB\Server\4.4\bin>mongo --port 27017
MongoDB shell version v4.4.1
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("54a136cb-2358-4751-bd56-6be311dfc86f") }
MongoDB server version: 4.4.1
---
The server generated these startup warnings when booting:
        2021-01-14T00:39:32.164+08:00: ***** SERVER RESTARTED *****
        2021-01-14T00:39:34.467+08:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
---
---
        Enable MongoDB's free cloud-based monitoring service, which will then receive and display
        metrics about your deployment (disk utilization, CPU, operation statistics, etc).

        The monitoring data will be available on a MongoDB website with a unique URL accessible to you
        and anyone you share the URL with. MongoDB may use this information to make product
        improvements and to suggest MongoDB products and deployment options to you.

        To enable free monitoring, run the following command: db.enableFreeMonitoring()
        To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
> use admin
switched to db admin
> db.createUser(
...   {
...     user: "myUserAdmin",
...     pwd: "abc123",
...     roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
...   }
...
... db.adminCommand( { shutdown: 1 } )

Could you let me know how to check if the new password and username is accepted by mongodb?

The error I get from Spring Boot is

Description:

Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.

Reason: Failed to determine a suitable driver class

but I have gotten all the right dependencis in my maven pom.xml

<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-mongodb</artifactId>
	</dependency>
	<!-- https://mvnrepository.com/artifact/org.mongodb/mongo-java-driver -->
	<dependency>
		<groupId>org.mongodb</groupId>
		<artifactId>mongo-java-driver</artifactId>
		<version>3.12.7</version>
	</dependency>

Please check your application.properties
for uri param you are using root but in the next line you are using different userid/password

If your user creation command went successfully you can check by login as that user

mongo -u myUserAdmin -p abc123 --authenticationDatabase admin --port 27017