假设将MongoDB安装在CentOS 8中的/usr/local/soft/mongodb中
1、先进入MongoDB的bin目录
cd /usr/local/soft/mongodb/bin
2、启动MongoDB
./mongod -f ../mongod.conf
出现以下内容则说明启动成功
about to fork child process, waiting until server is ready for connections.
3、连接客户端
以Navicat为例,先在Navicat手动连接CentOS 8上的MongoDB,再在Linux中让MongoDB连接客户端:
(前提是已经cd到bin目录中)
./mongo --host=192.168.1.1 --port=27017
其中192.168.1.1为自己的CentOS服务器IP地址