---
updatedAt: 2025-05-20T20:05:52.000Z
agentTools:
  projectIndex: https://help.scalegrid.io/llms.txt
---

# Create a Database User for MongoDB® with ScaleGrid

How to create a new database user for MongoDB® in less than one minute with ScaleGrid's DBaaS.

<HTMLBlock>{`

<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/3848622.js"></script>

`}</HTMLBlock>

Easily create new users for your database in a few simple clicks through our fully managed hosting platform.

## How to Create a New User for Your Database

1. Log into the [ScaleGrid console](https://console.scalegrid.io/), or create a [free 7-day trial](https://console.scalegrid.io/users/register).

> 🚧 Create a MongoDB® Cluster beforehand
>
> If you haven't already, you must first [create a cluster for MongoDB®](https://help.scalegrid.io/docs/mongodb-new-cluster) before adding users to your database.

2. Create a new user with appropriate permissions for client access. The roles you assign to the user will depend on your use case.

> 🚧 Create a new user
>
> We do not recommend connecting to your ScaleGrid for MongoDB® deployment using the “admin” user that ScaleGrid provides by default. Instead, create a new user.

The most common types of users that need to be created on MongoDB® are:

1. **Database Specific Users** - Users who have single [database specific roles](https://docs.mongodb.com/manual/reference/built-in-roles/#database-user-roles) assigned to them.
2. **All Database Users** - Users who have [All-Database roles](https://docs.mongodb.com/manual/reference/built-in-roles/#all-database-roles) assigned to them

## Database Specific Users

Here are the steps to create simple, per-database, read-write, or read-only MongoDB® users:

1. Log into the [ScaleGrid console](https://console.scalegrid.io/).
2. Navigate to your MongoDB® Cluster Details page.
3. Click on the Databases tab.
4. Then, click on the Manage button beside the database you want to create the user on:

![](https://files.readme.io/5fd8f03-Create-MongoDB-Database-User-ScaleGrid-Console.png "Create-MongoDB-Database-User-ScaleGrid-Console.png")

5. Select the Users tab and click on the New User button:

![](https://files.readme.io/a789291-Create-MongoDB-Database-New-User-ScaleGrid-Console.png "Create-MongoDB-Database-New-User-ScaleGrid-Console.png")

6. Fill in the new user’s name and password, then select its role and click Create:

![](https://files.readme.io/d6751a9-Create-MongoDB-Database-User-Wizard-Enter-Details.PNG "Create-MongoDB-Database-User-Wizard-Enter-Details.PNG")

## All Database Users

Users created on the admin database with [All-Database roles](https://docs.mongodb.com/manual/reference/built-in-roles/#all-database-roles) provide privileges that apply to all non-system databases during deployment. For this example, we will create a new user with [read-write access](https://docs.mongodb.com/manual/reference/built-in-roles/#all-database-roles) to any database on the cluster.

You can use the ScaleGrid web-shell available on the Admin tab to create such a user:

1. Log into the [ScaleGrid console](https://console.scalegrid.io/).
2. Navigate to your MongoDB® Cluster Details page.
3. Click on the Admin tab, and stay on the Web Shell tab on the left:

![](https://files.readme.io/a041968-Create-MongoDB-All-Database-User-In-Web-Shell.png "Create-MongoDB-All-Database-User-In-Web-Shell.png")

4. On the MongoDB® web-shell, type in the create new user command as shown in the text box below and represented in the image above:

```javascript
use admin
db.createUser({ user: "dbuser", pwd: "VeryCleverPassword", roles: ["readWriteAnyDatabase"] })
```

For creating users with more advanced roles and permissions, refer to these resources:

* [Creating Role-Based Access Control in MongoDB®](https://scalegrid.io/blog/creating-role-based-access-control-in-mongodb/)
* [MongoDB® - Add Users](https://docs.mongodb.com/manual/tutorial/create-users/)
* [MongoDB® - Built-In Roles](https://docs.mongodb.com/manual/reference/built-in-roles/#built-in-roles)