💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
``` docker pull mongo:4.4.15 ``` ``` mkdir -p /opt/mongo/data ``` 创建用户,先不启用认证 ``` docker run -p 11180:11180 -v /opt/mongo/data:/data/db --name mongo -d mongo:4.4.15 ``` ``` docker exec -it mongo /bin/bash ``` ``` use admin db.createUser({ user:'admin',pwd:'1wop9%&7',roles:[ { role:'userAdminAnyDatabase', db: 'admin'},{role:'readWriteAnyDatabase',db:'admin'}]}); ``` ``` > use ops; switched to db ops > db.createUser({ user:'ops',pwd:'j92rv3&002',roles:[ { role:'userAdmin', db: 'ops'},{role:'readWrite',db: 'ops'}]}); Successfully added user: { "user" : "ops", "roles" : [ { "role" : "userAdmin", "db" : "ops" }, { "role" : "readWrite", "db" : "ops" } ] } ``` ``` docker stop mongo docker container rm mongo ``` 启用认证模式 ``` docker run -p 11180:27017 -v /opt/mongo/data:/data/db --name mongo -d mongo:4.4.15 --auth ```