我已经下载mongodb msi文件格式mongodb网站,我已成功安装在C:\ Program Files\MongoDB\Server\3.2\bin我在命令提示符下使用命令作为mongodb具有管理员权限但出现错误
C:\Program Files\MongoDB\Server\3.2\bin>mongo MongoDB shell version: 3.2.0 connecting to: test 2016-01-05T15:08:52.215+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:10061 No connection could be made because the target machine actively refused it. 2016-01-05T15:08:52.229+0530 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed : connect@src/mongo/shell/mongo.js:224:14 @(connect):1:6 exception: connect failed
此处附有cmd提示的图像
执行mongod命令后出错就好了
C:\Program Files\MongoDB\Server\3.2\bin>mongod 2016-01-05T15:06:15.150+0530 I CONTROL [initandlisten] MongoDB starting : pid=12512 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-3F1GEI5 2016-01-05T15:06:15.161+0530 I CONTROL [initandlisten] targetMinOS: Windows Vista/Windows Server 2008 2016-01-05T15:06:15.167+0530 I CONTROL [initandlisten] db version v3.2.0 2016-01-05T15:06:15.171+0530 I CONTROL [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7 2016-01-05T15:06:15.179+0530 I CONTROL [initandlisten] allocator: tcmalloc 2016-01-05T15:06:15.183+0530 I CONTROL [initandlisten] modules: none 2016-01-05T15:06:15.186+0530 I CONTROL [initandlisten] build environment: 2016-01-05T15:06:15.190+0530 I CONTROL [initandlisten] distarch: x86_64 2016-01-05T15:06:15.195+0530 I CONTROL [initandlisten] target_arch: x86_64 2016-01-05T15:06:15.200+0530 I CONTROL [initandlisten] options: {} 2016-01-05T15:06:15.238+0530 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory C:\data\db\ not found., terminating 2016-01-05T15:06:15.246+0530 I CONTROL [initandlisten] dbexit: rc: 100
小智.. 5
mongod direct命令包含一些默认参数
mongod --dbpath=C:\data\db\ --port=27017
所以在c中创建一个文件夹数据,然后在其中创建一个db文件夹,然后运行该命令
mongod
您的服务器将处于运行状态,现在使用连接到它
mongo --port=27017
如果问题然后评论,这将对你有用
mongod direct命令包含一些默认参数
mongod --dbpath=C:\data\db\ --port=27017
所以在c中创建一个文件夹数据,然后在其中创建一个db文件夹,然后运行该命令
mongod
您的服务器将处于运行状态,现在使用连接到它
mongo --port=27017
如果问题然后评论,这将对你有用