Guest User

Untitled

a guest
Oct 24th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. mongod --auth --config mongod.conf --dbpath=datamongo4
  2.  
  3. db.createUser(
  4. {
  5. user: "us1",
  6. pwd: "abc123",
  7. roles: [ { role: "readWrite", db: "dbTest" }]
  8. }
  9. )
  10.  
  11. db.createUser(
  12. {
  13. user: "us2",
  14. pwd: "abc123",
  15. roles: [
  16. { role: "userAdminAnyDatabase", db: "admin" },
  17. { role: "root", db: "admin" },
  18. { role: "readWrite", db: "dbTest" }
  19. ]
  20. }
  21. )
  22.  
  23. spring.data.mongodb.host=localhost
  24. spring.data.mongodb.port=27017
  25. spring.data.mongodb.database=dbTest
  26. spring.data.mongodb.username=user
  27. spring.data.mongodb.password=pass
  28. spring.data.mongodb.authentication-database=dbTest
  29.  
  30. org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 13 and error message 'command find requires authentication' on server localhost:27017; nested exception is com.mongodb.MongoQueryException: Query failed with error code 13 and error message 'command find requires authentication' on server localhost:27017
Add Comment
Please, Sign In to add comment