Guest User

Untitled

a guest
Dec 4th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. systemLog:
  2. destination: file
  3. path: "/root/mongodb.log"
  4. logAppend: true
  5.  
  6. net:
  7. port: 25015
  8.  
  9. processManagement:
  10. fork: true
  11.  
  12. setParameter:
  13. enableLocalhostAuthBypass: true
  14.  
  15. storage:
  16. dbPath: /root/mongo_data
  17. engine: wiredTiger
  18.  
  19. mongo --port 25019
  20.  
  21. > use admin;
  22. switched to db admin
  23. > db.createUser(
  24. {
  25. user: "siteUserAdmin",
  26. pwd: "eqt-dfts-mad-ghbr-ovd-g",
  27. roles: [{role: "userAdminAnyDatabase", db: "admin"}]
  28. }
  29. )
  30. Successfully added user: {
  31. "user" : "siteUserAdmin",
  32. "roles" : [
  33. {
  34. "role" : "userAdminAnyDatabase",
  35. "db" : "admin"
  36. }
  37. ]
  38. }
  39.  
  40. > use MyDatabase;
  41. switched to db MyDatabase
  42. > db.createUser(
  43. {
  44. user: "my_user",
  45. pwd: "cu-npp-re-jpor-mtw-e-s",
  46. roles: [
  47. {role: "readWrite", db: "MyDatabase"},
  48. {role: "dbAdmin", db: "MyDatabase"}
  49. ]
  50. }
  51. )
  52. Successfully added user: {
  53. "user" : "vantage",
  54. "roles" : [
  55. {
  56. "role" : "readWrite",
  57. "db" : "AdVantage"
  58. },
  59. {
  60. "role" : "dbAdmin",
  61. "db" : "AdVantage"
  62. }
  63. ]
  64. }
  65.  
  66. > use MyDatabase;
  67. switched to db MyDatabse
  68. > db.createCollection("demotest")
  69. { "ok" : 1 }
  70. > show collections;
  71. demotest
  72. > show dbs;
  73. MyDatabase 0.000GB
  74. admin 0.000GB
  75. local 0.000GB
  76. > exit
  77. bye
  78.  
  79. PROMPT> mongo --host 102.216.73.164 -u my_user -p cu-npp-re-jpor-mtw-e-s --authenticationDatabase MyDatabase --port 25019
  80. MongoDB shell version: 2.6.6
  81. connecting to: 102.216.73.164:25019/test
  82. 2015-05-13T21:03:18.963-0400 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1210
  83. exception: login failed
Add Comment
Please, Sign In to add comment