Ubuntu14上安装Mongo3.2
1. 安装
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D68FA50FEA312927 echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list sudo apt-get update sudo apt-get install -y mongodb-org sudo service mongod start
2. 允许远程连接
sudo vim /etc/mongod.conf bindIp处改为 bindIp = 0.0.0.0
sudo service mongod restart
3. auth设置
sudo vim /etc/mongod.conf bind_ip 添加: security: authorization: enabled
sudo service mongod restart
4. 新建数据库及用户
use order db.createCollection('OrderInfo') db.createUser( { user: "order", pwd: "123456", roles: [ "readWrite", "dbAdmin" ] })
---栖息之鹰(一个外表懒洋洋的内心有激情的程序员)
此博客为笔者原著,转载时请注明出处,谢谢!