Files
notes/tiddlywiki/MongoDB - enable authentication using SCRAM-SHA-1.txt
2026-03-12 22:01:38 +01:00

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"