-
Ensure that the MongoDB database has been installed and the mongod service has been started. -
On the MongoDB server, open the/etc/mongod.conf file and edit it to allow remote connections. Add 0.0.0.0 to the bindIp field to allow all IPs to access the database. For example: bindIp: 0.0.0.0 -
Assign an account to the MongoDB user and grant the required permissions. -
On the client computer, use the MongoDB client (such as the mongo shell or other third-party applications) to connect to the MongoDB database. An example command is as follows:
mongo --host < hostname > --port < port > -u < username > -p < password > --authenticationDatabase < auth_database >
-
After the connection is successful, you can use the corresponding command to manage the MongoDB database.