Step 1
I executed in the MongoDB terminal:
use admin;
db.createUser ({
user: "admin",
pwd: "<password>",
roles: [{role: "userAdminAnyDatabase", db: "admin"}, "readWriteAnyDatabase"]
});
Step 2
I have set in:
security:
authorization: enabled
docs.mongodb.com/v4.2/reference/configuration-options/#security.authorization
Step 3
service mongo restart