How To Manage Your MongoDB Database Manager
Quick Intro
The MongoDB Database Manager allows you to create and manage your databases. Keep in mind that the database takes up your disk space. You can connect your databases to your web projects or any other hosted CMS using your database credentials.
Important To Know Before You Begin
To create a database, you must set up a Database Name, Database Username, and Database Password.
By default, the Database Username is the same as your Database Name. The password is set randomly by the system and can be changed later, if needed.
Each database has unique credentials and does not interfere with other created databases in your account.
Your database credentials will start with a part of your login information, and it's not editable.
Creating New MongoDB Database
To create a new database, follow these steps:
-
Navigate to MongoDB Database Manager:
- In your Web Control Panel, go to:
Website Management > Databases > MongoDB
- In your Web Control Panel, go to:
-
Create a New Database:
- Click on Create Database tab.
-
Enter Database Details:
- Database Name: Enter your desired database name.
- Database Username: By default, the username is the same as the database name. Deselect the option if you need to customize it.
- Database Password: There are no password field. The password is randomly generated for each new database user.
-
Create the Database:
- Once all fields are filled, click Create DB to finalize the process.
-
See the list of MongoDB Databases
- Navigate to the List Databases tab to see the database created.
Once your database has been created, you can manage it using a graphical interface via List Databases tab (Actions section).
- Access MongoDB Users
- To access MongoDB Users navigate to List DB Users, find the icon with Gear and click on it. From there you can manage allowed hosts. Also, you can change the password for the database user by clicking to the Lock icon and ask the system to generate another random password for you.
Working with Remote MongoDB Databases
WebHostMost allows you to connect to remote databases using the Web Control Panel. This feature is particularly useful if you need to manage databases hosted on a different server or wish to access your database from an external application.
Allowing Hostnames or IP Addresses via the Web Control Panel
For remote database connections, you need to specify the hostnames or IP addresses that are allowed to connect to your database. Here’s how to allow remote connections:
-
Access the Database Setup:
- Go to Web Control Panel > Databases > MongoDB Database Manager > Manage Users.
-
Add Remote Host:
- Select the user associated with the database.
- In the Access Hosts section, enter the hostname or IP address that will be allowed to connect remotely. You can use
0.0.0.0/0
as a wildcard to allow all IP addresses (not recommended for security reasons). - Click Allow IP or Subnet.
Security Tip: Only allow specific IP addresses or hostnames to access your database remotely. Using wildcards can expose your database to unauthorized access.
Connecting to the MongoDB Remote Database
Once you've set up the database user and allowed the necessary hostnames or IP addresses, you can connect to the remote database using any MongoDB client, terminal, or application. Here’s how to do it:
Connecting via Terminal to the Remote MongoDB Database
You can connect to your remote database using the MongoDB command-line tool. Here’s an example command:
mongo --username yourdatabaseusername --host serverX.webhostmost.com --db yourdatabase
Replace yourdatabaseusername
with your database username, serverX.webhostmost.com
with the actual server (where X is the server number), and yourdatabase
with the database name. After running the command, you will be prompted to enter your database password.
Connecting via MongoDB Compass or Other Tools
- Open your MongoDB client (e.g., MongoDB Compass).
- Enter the following details:
- Host:
serverX.webhostmost.com
(replace X with your server number). - Username: Your database username.
- Password: Your database password.
- Database: Your database name.
- Host:
- Connect to the database.
Best Practices for Remote Database Management
- Use Strong Passwords: Always use strong, complex passwords for database users, especially when allowing remote access.
- Restrict Access: Limit access to only the IP addresses or hostnames that need it. Avoid using wildcards.
- Monitor Activity: Regularly monitor your database activity for unauthorized access or unusual queries.
- Backup Regularly: Always keep backups of your databases, especially when working with remote connections.
Conclusion
With the ability to manage both local and remote MongoDB databases through the Web Control Panel, WebHostMost provides a flexible environment for your web projects. By following the steps and best practices outlined in this guide, you can efficiently manage and secure your databases.
For further assistance, don’t hesitate to contact our support team.
Manage your MongoDB databases confidently, whether they’re local or remote, by leveraging the powerful tools available in your Web Control Panel.