本文介绍了Mongodb:无法连接到127.0.0.1:27017,原因:errno:10061的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 这是我的 mongod.cfg 文件: bind_ip = 127.0.0.1 dbpath = C:\mongodb\data\db logpath = C:\mongodb\log\mongo-server.log verbose = v 这是我的 mongod 服务命令: mongod -fc:\mongodb\mongod.cfg --install 我已经安装了MongoDB大约一个星期前,它一切正常,但今天当我运行 mongo 命令I发生以下错误: 无法连接到127.0.0.1:27017,原因:errno:10061无连接因为目标机器主动拒绝它 我如何解决这个问题? strong> 我使用Windows 8.1 解决方案: 我忘记使用此命令启动mongodb服务: net start mongodb 改进的解决方案: strong>将目录更改为根驱动器 C:\ ,然后在管理员 cmd 提示符窗口中键入以下命令, C:\mongodb\bin\mongod.exe --config c:\mongodb\mongod.cfg --install 2)然后键入 net启动MongoDB 之后,您应该会看到以下消息: Mongo DB服务已成功启动 3)然后转到控制面板开始>管理工具>服务,在服务列表中向下滚动到MongoDB,并将启动类型更改为自动,如果您愿意的话。 4)最后输入 C:\mongodb\bin\mongo.exe code>,您应该连接到Mongo测试数据库。 参考: https://www.youtube.com/watch?v=-mik4dPArCU 解决方案这是我如何解决它,你可以在这里一步一步: MongoDB步骤: 下载最新的64位MSI版本的 MongoDB Windows。 运行安装程序(.msi文件) > PATH 环境变量。它应该是: C:\Program Files\MongoDB\Server\3.0\bin 现在在 C:/ 中创建一个\data\db mongodb 来存储所有数据。您应该具有此文件夹: C:\data\db 注意:这是mongoDB预期的默认目录位置,不在其他位置创建 。 最后,打开命令提示符并键入: > ; mongod 您应该看到它请求权限(允许),然后侦听端口。 输入新的命令提示符 $ b b >> mongo 您应该看到它显示版本并连接到测试数据库。 这证明已成功安装!=) 参考链接 Here is my mongod.cfg file:bind_ip = 127.0.0.1dbpath = C:\mongodb\data\dblogpath = C:\mongodb\log\mongo-server.logverbose=vHere is my mongod service command:mongod -f c:\mongodb\mongod.cfg --installI have installed MongoDB about a week ago and it all worked fine, however today when I ran mongo command I got the following error:Failed to connect to 127.0.0.1:27017,reason: errno:10061 No connection could be made because the target machine actively refused itHow can I fix that? I use Windows 8.1Solution:I forgot to start mongodb service with this command:net start mongodbImproved solution:1) Change directory to root drive C:\, and type the command below into an admin cmd prompt window,C:\mongodb\bin\mongod.exe --config c:\mongodb\mongod.cfg --install2) Then type net start MongoDB after which you should see the following message:"The Mongo DB service was started successfully"3) Then go to the control panel Start>Administrative Tools>Services, scroll down to MongoDB in the list of services and change start up type to automatic, if you so desire. Press OK.4) Finally type C:\mongodb\bin\mongo.exe and you should be connected to the Mongo test DB.Reference: https://www.youtube.com/watch?v=-mik4dPArCU 解决方案 This is how I solved it, You can follow step by step here:MongoDB Steps:Download the latest 64-bit MSI version of MongoDB for Windows.Run the installer (.msi file)Add it to your PATH of environment variables. it Should be from:C:\Program Files\MongoDB\Server\3.0\binnow Create a "\data\db" folder in C:/ which is used by mongodb to store all data. You should have this folder:C:\data\db Note: This is the default directory location expected by mongoDB, don’t create anywhere else.Finally, open command prompt and type:>> mongodYou should see it asking for permissions (allow it) and then listen to a port.After that is done, open another command prompt, leaving the previous one running the server.Type in the new command prompt>> mongoYou should see it display the version and connect to a test database.This proves successful install!=)Reference link 这篇关于Mongodb:无法连接到127.0.0.1:27017,原因:errno:10061的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-11 11:22