[英]MongoDB isn't connecting to the server 127.0.0.1:27017 and showing target machine actively refused it
I run this command C:\Program Files\MongoDB\Server\4.2\bin\mongo.exe
start my mongoDB but it is showing this error:我运行此命令
C:\Program Files\MongoDB\Server\4.2\bin\mongo.exe
start my mongoDB 但它显示此错误:
MongoDB shell version v4.2.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-04-17T18:28:32.535+0530 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: No connection could be made because the target machine actively refused it. :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-04-17T18:28:32.541+0530 F - [main] exception: connect failed
2020-04-17T18:28:32.541+0530 E - [main] exiting with code 1
My mongoDB compass isn't connecting too..我的 mongoDB 罗盘也没有连接..
mongo
( mongo.exe
for windows users) does not start the server. mongo
( mongo.exe
用户的 mongo.exe)不启动服务器。 It is used to connect to a server which is already running.它用于连接到已经在运行的服务器。
You should run mongod
in the command line before connecting to the server, it will initialite it.您应该在连接到服务器之前在命令行中运行
mongod
,它将初始化它。 You can't connect to the server you haven't started无法连接到尚未启动的服务器
Try to comment out this last line mp at \bin\mongodb.cfg.尝试在 \bin\mongodb.cfg 中注释掉最后一行 mp。 becomes #mp: Restart mongod.
变成#mp:重启mongod。
You can check whether your mongodb is running at the service (task Manager->Services ->Mongodb)..(Make sure you click Property to see all those setting)您可以检查您的 mongodb 是否在服务上运行(任务管理器->服务-> Mongodb)..(确保单击属性以查看所有这些设置)
Hope this helps.希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.