How to Create User and Enable Authentication to Secure MongoDB Version 6.0.1+ | Part 2

Опубликовано: 02 Ноябрь 2024
на канале: Code Sagar
2,094
59

In this video, I will guide you how to Create Admin User and Enable authentication to Secure MongoDB Version (6.0.1+) on Ubuntu 22.04 LTS. #Mongodb #Ubuntu #Secure

Subscribe For More Such Videos:    / @codesagarofficial  

##### Secure MongoDB #####

Connect MongoDB:
mongosh

List of Databases:
show dbs

Connect to Admin Database
use admin

Create User Method:
db.createUser( { user: “admin”, pwd: passwordPrompt(), roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ] } )

Get List of Users
db.getUsers()

Delete User:
db.dropUser(“test”)

Configuration File:
sudo nano /etc/mongod.conf

security:
authorization: enabled

Connect MongoDB with options:
mongosh -u admin -p --authenticationDatabase admin


Manage MongoDB:
sudo systemctl start mongod.service
sudo systemctl status mongod
sudo systemctl enable mongod
sudo systemctl restart mongod


Once you complete watching this tutorial. I would suggest you follow the installation steps on your computer. If you encounter errors or didn't understand something, ask me questions in the comments section of this video.


Topic Covered:
00:00 Overview about steps
00:30 Create User in MongoDB Admin Database
02:12 Enable Authentication in Config File
02:50 Testing with and without credentials using mongo shell


if you like this video, please do subscribe now and press the bell icon to not miss any update from #CodeSagar

Other Databases Videos:
Install and configure Mysql 8.0.30 on Linux Ubuntu 22.04 LTS
Link:    • Install and configure Mysql 8.0.30 on...  

How to Install MongoDB 6.0.1+ on Ubuntu 22.04 LTS
Link:    • How to Install MongoDB 6+ on Ubuntu 2...  

#mongodb
#secure
#enableAuthentication
#createUser
#latest
#configration
#installation
#database
#linux
#aws
#ec2
#awscli
#awstraining