-
MongoDB) 4.x버전대 계정만들기Programing Language/Database 2021. 4. 18. 20:12728x90반응형This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
1. 설치후 접속 - mongo localhost:27017 2.계정만들기 (admin) > use admin switched to db admin > db.createUser( { user: "test", pwd: "test1234", // or cleartext password roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ] } ) //슈퍼 유저 계정을 만들고 싶다면 > db.createUser( { user: "dba", pwd: passwordPrompt(), // or cleartext password roles: [ "root" ] } ) 3. security.authorization 옵션 활성화 /* /etc/mongo.conf 파일 안에 해당 옵션을 활성화 시켜줘야 authentication이 동작을 하기 때문에 파일을 수정해줘야 합니다. 해당 옵션을 변경하면 MongoDB를 재구동 해야하니 주의하시기 바랍니다. */ ------------------------ security: authorization: enabled ------------------------ security 부분의 주석을 제거하고, authorization: enabled 옵션을 넣어 줍니다. - systemctl restart mongod 4. 생성한 계정으로 접근하기 - mongo --port 27017 -u "test" -p "test1234" --authenticationDatabase "admin" 참고자료
rastalion.me/mongodb-4-2-admin-%EA%B3%84%EC%A0%95-%EC%84%A4%EC%A0%95%ED%95%98%EA%B8%B0/
MongoDB 4.2 admin 계정 설정하기 - RastaLion's IT Blog
MongoDB admin 4.2 계정 설정하기 MongoDB 아틀라스 배포가 아닌, Linux서버에 직접 패키지를 올려 설치하게 되면, Authentication이 없습니다. 저 역시 CentOS7에 커뮤니티를 올려서 사용하고 있어서, 처음에
rastalion.me
728x90반응형'Programing Language > Database' 카테고리의 다른 글
MongoDB) ObjectId에 대해서 (0) 2021.04.19 MongoDB) shell에서 find할때 pretty()기능을 기본값으로 하기 (0) 2021.04.19 MongoDB) 기본 사용법 (0) 2021.04.19 MongoDB) Failed to unlink socket file","attr":{"path":"/tmp/mongodb-27017.sock","error":"Operation not permitted (0) 2021.04.18 MongoDB) 몽고DB(MongoDB) 설치 [참고자료] (0) 2021.04.18