我如何解决错误:MongoTimeoutError:服务器选择在30000毫秒后超时,无法连接到服务器127.0.0.1:27017

时间:2020-01-11 10:03:09

标签: mongodb timeout nodejs-server

我如何解决错误:MongoTimeoutError:服务器选择在30000毫秒后超时,无法连接到服务器127.0.0.1:27017

1 个答案:

答案 0 :(得分:1)

要在本地连接MondoDB时解决此错误。 enter image description here enter image description here enter image description here

使用以下这些步骤重新连接或再次在本地连接MongoDB。 1.在安装了MongoDB的 bin 文件夹中打开两个cmds。 像:(C:\ Windows \ System32 \ cmd.exe)

  1. 在第一次cmd运行中:mongod,随后的命令如下图所示运行。 enter image description here

  2. 在第二个cmd中运行:mongo enter image description here

完成上述所有步骤后,请在本地重新连接MongoDB