记录程序猿开发过程中已经遇到的各种坑,再记录解决方法 / Record the various pits that have been encountered during the development process, and then record the solution.
2
stars
0
forks
source link
Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js #4
Open
jingxinxin opened 6 years ago
首先明白就是链接失败,是否是服务器重启,mongo服务没有设置自动启动,可以首先启动mongo服务再试试
启动MongoDB
$ sudo systemctl start mongod.service
查看是否启动成功
$ sudo systemctl status mongod.service
若显示 active(running)则启动成功!或者
$ sudo cat /var/log/mongodb/mongod.log
如出现 [thread1] waitingforconnectionsonport
其中的默认为27017,在 /etc/mongod.conf中配置,则启动成功!