Article Directory
Various problems encountered by MongoDB during development
1. Install versions below 6
If you install MongoDB version below version 6, you can refer to the following bloggers
->自动安装版
(26 messages) MongoDB installation (super detailed)_AI bro's blog-CSDN blog
<-
2. Install version 6 and above
To install MongoDB6 version and above, you can refer to the following bloggers
->自动安装版
<-
3. Install versions below 6 (unzip version)
If you install the decompressed version below MongoDB6, you can refer to the following bloggers
->解压版
Installation and use of MongoDB under Windows - Zhihu (zhihu.com)
<-
Fourth, configure the local Windows MongoGB service
After installing and configuring the relevant information, if you want to start MongoDB locally, refer to the following bloggers. The content is probably in the back, mainly for this to run in the bin directory of cmd.
ps: mongod -dbpath "D:\MyApp\Mongodb\Server\data\db" -logpath "D:\MyApp\Mongodb\Server\data\log\mongo.log" -install -serviceName "MongoDB"
Pay attention to modify your own path
->自动安装版
<-
5. navicat connects to remote mongodb database
Beginners should pay special attention to the fact that admin is the database of the system. You can set the account password and permissions readWriteAnyDatabase
or root
both. At this time, you can only test whether the login is successful under Navicat. Remember to reconfigure the account password and permissions for the newly created database .
Otherwise it will be this errorCaused by: com.mongodb.MongoCommandException: Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server 127.0.0.1:27017. The full response is {"ok": 0.0, "errmsg": "Authentication failed.", "code": 18, "codeName": "AuthenticationFailed"}
Because: Each database in MongoDB is independent of each other and has independent permissions. The correct way is to reconfigure the account password and permissions for the newly created database .
Navicat connects to the remote mongodb database, you can refer to the following bloggers:
->连接远程
<-
6. The problem of ip inconsistency
Abnormal ip inconsistency when MongoDB is runningcom.mongodb.MongoSocketOpenException: Exception opening socket
If the local test can check whether it is , you need to modify the configuration file when deploying to the remote server. Add bind_ip=0.0.0.0127.0.0.1
in conf/Mongodb.conf . Adding this parameter is to allow any ip to connect to MongoDB.
具体情况具体分析,开发过程中解决问题是多方面的,从各种博主中寻找部分正解运用到自己的项目中,即可解决问题,上述提到的博主都是结合经验参考,觉得方案可行的