在 Linux 上,MongoDB 默认端口是 27017。
常见说明:
27017/etc/mongod.conf(包安装,如 yum/apt)mongod.conf 中):net:
port: 27017
bindIp: 127.0.0.1
修改后重启 MongoDB:sudo systemctl restart mongod
补充:
270172701927018如果你是问“Linux 防火墙要开放哪个端口”,那就是 27017(或你自定义修改后的端口)。
需要我帮你检查 mongod.conf 或防火墙配置吗?