Tag: sourceedit |
Tag: sourceedit |
||
(One intermediate revision by the same user not shown) | |||
Line 15: | Line 15: | ||
=== mongo db create user & security === |
=== mongo db create user & security === |
||
+ | * start mongo no security |
||
+ | ./mongo |
||
+ | >use admin |
||
+ | > db.createUser({ |
||
+ | user:'admin', pwd: 'admin', |
||
+ | customData: {desc: 'The admin user for admin db'}, |
||
+ | roles: ['readWrite', 'dbAdmin', 'clusterAdmin'] |
||
+ | }) |
||
+ | |||
+ | * start mongod with --auth option |
||
+ | mongod --auth |
Latest revision as of 09:37, 18 November 2016
download & install[]
Amazon Linux[]
- https://www.mongodb.com/download-center#community
- wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-amazon-3.2.10.tgz
- unzip and check README
- mkdir -p /data/db; chown ec2-user:ec2-user /data/db
- export LC_ALL=en_US.UTF-8
- echo "export LC_ALL=en_US.UTF-8" >> ~/.bashrc
- ./bin/mongod
specify data folder[]
mongod --dbpath /Users/dev/mongodb_data
mongo db create user & security[]
- start mongo no security
./mongo >use admin > db.createUser({ user:'admin', pwd: 'admin', customData: {desc: 'The admin user for admin db'}, roles: ['readWrite', 'dbAdmin', 'clusterAdmin'] })
- start mongod with --auth option
mongod --auth