25 lines
594 B
Plaintext
Executable File
25 lines
594 B
Plaintext
Executable File
-- create database for user management
|
|
use admin
|
|
-- create first superuser
|
|
> db.createUser({ user: "superhero", pwd: "secret", roles: ["root"]});
|
|
-- to list all users
|
|
> show users
|
|
|
|
-- add in MongoDB configuration file ->
|
|
security:
|
|
authorization: 'enabled'
|
|
<-------------------------------------
|
|
|
|
-- restart MongoDB
|
|
systemctl stop mongod
|
|
systemctl start mongod
|
|
|
|
-- to connect within mongo shell
|
|
> use admin
|
|
> db.auth('superhero', 'secret');
|
|
|
|
-- authentification at mongo shell connection
|
|
mongo --host frdrpsrv4483 --username "superhero" --password "secret" --authenticationDatabase "admin"
|
|
|
|
|