报错原因如下:

MongoDB shell version v3.4.2
connecting to: mongodb://127.0.0.1:27017
2017-03-01T12:06:59.013+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2017-03-01T12:06:59.015+0800 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed

试了好多方法都没有解决,最后解决办法如下:

1> 进入终端,执行以下命令:

brew services start mongodb

2>再次启动即可:

mongo

启动mongodb报错,无法连接mongodb

 

查看mongodb安装目录:

which mongodb

 

相关文章:

  • 2021-12-04
  • 2021-12-20
  • 2021-09-19
  • 2022-12-23
  • 2021-08-16
  • 2021-11-15
  • 2021-10-18
  • 2022-12-23
猜你喜欢
  • 2021-12-30
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2021-06-14
  • 2022-12-23
相关资源
相似解决方案