基于ubuntu的MongoDB 以及window 远程访问ubuntu(linux) 教程 以及可视化界面使用

使用linux 操作mongodb数据库

systemctl start mongod 启动mongod 服务 才能开启mongo
然后输入 mongo --port 27017 启动mongodb

可视化界面 软件robo3t 在robomongo robo3t bin 目录下 robo3t 使用./robo3t 启动可视化界面

win 可以远程访问虚拟机的mongodb 需要设置ip
在linux 里面 vim /etc/mongod.conf 里面修改bindip 绑定ip设置成虚拟机当前ip 然后win 可以打开网页
在url里面输入 ip:端口号 进行访问 如果出现
It looks like you are trying to access MongoDB over HTTP on the native driver port.
则代表连接成功
win 里面打开cmd 输入
mongo 10.66.67.30(linux的ip):27017/test(数据库名)
即可对虚拟机里面的mongodb 进行操作(win 要开启mongod)

如果更改了 mongod 的配置
那么从linux 启动mongo 就不能像之前了 mongo --port 27017 这样来启动
我们要 换一个命令 mongo --host 当前linux 的ip地址

猜你喜欢

转载自blog.csdn.net/weixin_43557780/article/details/85228653
今日推荐