Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Ubuntu 18.04 configure MongoDB password login

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

System:

Ubuntu 18.04

MongoDB: 4.2,3

Install MongoDB server and client (for testing) # add MongoDB GPG key apt-key adv-- keyserver hkp://keyserver.ubuntu.com:80-- recv 4B7C549A058F8B6B# create MongoDB repository echo "deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee / etc/apt/sources.list.d/mongodb.listapt-get updateapt-get install mongodb-orgapt-get install mongodb-clients launch MongoDB

Systemctl start mongod.service

Log in to MongoDB and set password # Log in to mongo# and switch to admin database use admin# to create admin account. Password: admin111 permission: root permission, authorized database name: admindb.createUser ({user: "admin", pwd: "admin111", roles: [{role: "root", db: "admin"}]})

Edit MongoDB profile

Vim / etc/mongod.confnet: port: 27017 # Port bindIp: 0.0.0.0 # allowed access address, 0.0.0.0 indicates all security: authorization: enabled

Restart the MongoDB service

Systemctl restart mongod.service

Test login

Mongo-u admin-p admin111-- authenticationDatabase admin

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report