[Solved] Linux Mongodb Error: # Error: coul-bash: connecting: command not found

1. MongoDB error content and solution
This is an error when entering mongo startup

[[email protected] mongodb]# Error: coul-bash: connecting: command not found
.1:27017 :: caused by :: Connection refused :ction attempt failed: SocketException: Error connecting to 127.0.0
[1]+ Exit 127 connecting to: mongodb://127.0.0.1:27017/?compressors=disabled
[email protected]/mongo/shell/mongo.js:374:17
@(connect):2:6
exception: connect failed
exiting with code 1
Change the permission of .sock file.

Next, we check the error report of the MongoDB log

"ctx":"SignalHandler","msg":"Shutdown: going to close listening sockets"}
{"t":{"$date":"2021-11-14T21:50:59.901+08:00"},"s":"I",  "c":"NETWORK",  "id":23017,   "ctx":"listener","msg":"removing socket file","attr":{"path":"/tmp/mongodb-27017.sock"}}
{"t":{"$date":"2021-11-14T21:50:59.901+08:00"},"s":"I",  "c":"NETWORK",  "id":4784905, "ctx":"SignalHandler","msg":"Shutting down the global connection pool"}

Solution:

The above log has said to remove mongodb-27017.sock in the/tmp directory
here, you can switch to the TMP directory to view the mongodb-xxx.sock file
remove the mongodb-27017.sock file, and then restart OK successfully
if you have tried to switch ports, remove all mongodb-xxx.sock files

Read More: