Mongo MacOS的连接拒绝

问题描述

每当我尝试从终端执行命令tClients (Table) AClientID (Primary Key,INT) sClientName (VARCHAR(255)) 时,都会弹出此错误:

mongo

我一直遵循this教程,以便在MacBook Pro上安装mongo,但由于创建了MongoDB shell version v4.4.0 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb 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 :: Connection refused : connect@src/mongo/shell/mongo.js:362:17 @(connect):2:6 exception: connect failed exiting with code 1 而失败。后来,this的另一篇文章出现在我身上。第二个命令命令我从终端运行下一段代码:

/data/db

但是出现了我一开始粘贴的相同错误。

我能做些什么来安装并保持mongo运行吗?

操作系统: macOS Catalina-10.15.16

谢谢!

解决方法

尝试:

brew services start mongodb/brew/mongodb-community
,

对于macOS用户:

1,重新安装mongodb-community

brew uninstall mongodb-community
brew cleanup
brew install mongodb/brew/mongodb-community

2,配置并启动

sudo mongod --config /usr/local/etc/mongod.conf
brew services start mongodb-community

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...