Last active
February 23, 2016 17:45
-
-
Save RenzoTejada/126fedff03700ed6732f to your computer and use it in GitHub Desktop.
AGREGAR COLECCION ADMIN Y USUARIO PRINCIPAL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Accediendo a mongo y creando usuario "admin" | |
use admin | |
db.createUser( { user: "admin", pwd: "admin", "roles" : [ { "role" : "root", "db" : "admin" } ] }); | |
Accedes como usuario "admin": | |
mongo 127.0.0.1/admin -u admin -p admin | |
Habilitando authentication | |
sudo /etc/init.d/mongod stop | |
sudo geany /etc/mongod.conf agregar => auth=true | |
sudo /etc/init.d/mongod start | |
Creando usuario con credenciales | |
-ingresar como usuario "admin": | |
use bd_prueba | |
db.createUser( { user: "usr_prueba", pwd: "p@s$w0Rd", roles: [ { "role" : "readWrite", db: "bd_prueba" } ] }); | |
Ingresando como usuario owner (recien creado): | |
mongo 127.0.0.1/bd_prueba -u usr_prueba -p 'p@s$w0Rd' | |
Eliminando usuario | |
db.removeUser(usr_prueba); | |
Listar Todos los usuario | |
db.system.users.find(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment