MongoDB - admin user not authorized on sandbox plan
up vote
0
down vote
favorite
I am trying to upgrade my sandbox database server version to 4.x.x. It is now at 3.6.6
In order to do that, I need to create an admin user.
So I connect to the mongo shell and I run the following :
db.createUser( { user: "admin", pwd: "password", roles: [ { role: "root", db: "mydatabasename" } ] } );
However, I get the following error :
Error: couldn't add user: not authorized on admin to execute command
It's been hours I am trying to figure out this issue. Other stackoverflow related questions don't solve it.
I am wondering if it is even possible to do so on a non dedicated database server. If not, how can I upgrade the server version ?
Any help would be greatly appreciated.
mongodb mlab
add a comment |
up vote
0
down vote
favorite
I am trying to upgrade my sandbox database server version to 4.x.x. It is now at 3.6.6
In order to do that, I need to create an admin user.
So I connect to the mongo shell and I run the following :
db.createUser( { user: "admin", pwd: "password", roles: [ { role: "root", db: "mydatabasename" } ] } );
However, I get the following error :
Error: couldn't add user: not authorized on admin to execute command
It's been hours I am trying to figure out this issue. Other stackoverflow related questions don't solve it.
I am wondering if it is even possible to do so on a non dedicated database server. If not, how can I upgrade the server version ?
Any help would be greatly appreciated.
mongodb mlab
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to upgrade my sandbox database server version to 4.x.x. It is now at 3.6.6
In order to do that, I need to create an admin user.
So I connect to the mongo shell and I run the following :
db.createUser( { user: "admin", pwd: "password", roles: [ { role: "root", db: "mydatabasename" } ] } );
However, I get the following error :
Error: couldn't add user: not authorized on admin to execute command
It's been hours I am trying to figure out this issue. Other stackoverflow related questions don't solve it.
I am wondering if it is even possible to do so on a non dedicated database server. If not, how can I upgrade the server version ?
Any help would be greatly appreciated.
mongodb mlab
I am trying to upgrade my sandbox database server version to 4.x.x. It is now at 3.6.6
In order to do that, I need to create an admin user.
So I connect to the mongo shell and I run the following :
db.createUser( { user: "admin", pwd: "password", roles: [ { role: "root", db: "mydatabasename" } ] } );
However, I get the following error :
Error: couldn't add user: not authorized on admin to execute command
It's been hours I am trying to figure out this issue. Other stackoverflow related questions don't solve it.
I am wondering if it is even possible to do so on a non dedicated database server. If not, how can I upgrade the server version ?
Any help would be greatly appreciated.
mongodb mlab
mongodb mlab
edited Nov 11 at 15:08
asked Nov 11 at 12:12
Louis
13812
13812
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
If this is first ever user you're trying to connect in DB, you need to use "Localhost Exception":
The localhost exception allows you to enable access control and then
create the first user in the system. With the localhost exception,
after you enable access control, connect to the localhost interface
and create the first user in the admin database. The first user must
have privileges to create other users, such as a user with the
userAdmin or userAdminAnyDatabase role
Create a user as follows:
use admin;
db.createUser( { user: "userAdminAnyDB", pwd: "password", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] } );
db.auth("userAdminAnyDB", "password")
Once you successfully login using userAdminAnyDB credentials, create a required for your Db deployment.
db.createUser( { user: "admin", pwd: "password", roles: [ { role: "root", db: "mydatabasename" } ] } );
Thank you for your answer ! How do I use Localhost Exception ?
– Louis
Nov 11 at 14:47
Following the first set of commands, I get :Error: couldn't add user: not authorized on mydatabasename to execute command { createUser: "userAdminAnyDB", pwd: "xxx", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
– Louis
Nov 11 at 14:48
I am using mlab and have already 2 users created via mlab but I doubt they have admin privileges. I am not even sure if this is the same users we're talking about via mongo shell
– Louis
Nov 11 at 14:53
If users are already created, you need to login using user who has privileges to create user and grant admin privileges
– Astro
Nov 11 at 14:55
None of them has admin privileges. I am not allowed to grant them admin privileges neither (error raised)
– Louis
Nov 11 at 14:57
|
show 1 more comment
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
If this is first ever user you're trying to connect in DB, you need to use "Localhost Exception":
The localhost exception allows you to enable access control and then
create the first user in the system. With the localhost exception,
after you enable access control, connect to the localhost interface
and create the first user in the admin database. The first user must
have privileges to create other users, such as a user with the
userAdmin or userAdminAnyDatabase role
Create a user as follows:
use admin;
db.createUser( { user: "userAdminAnyDB", pwd: "password", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] } );
db.auth("userAdminAnyDB", "password")
Once you successfully login using userAdminAnyDB credentials, create a required for your Db deployment.
db.createUser( { user: "admin", pwd: "password", roles: [ { role: "root", db: "mydatabasename" } ] } );
Thank you for your answer ! How do I use Localhost Exception ?
– Louis
Nov 11 at 14:47
Following the first set of commands, I get :Error: couldn't add user: not authorized on mydatabasename to execute command { createUser: "userAdminAnyDB", pwd: "xxx", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
– Louis
Nov 11 at 14:48
I am using mlab and have already 2 users created via mlab but I doubt they have admin privileges. I am not even sure if this is the same users we're talking about via mongo shell
– Louis
Nov 11 at 14:53
If users are already created, you need to login using user who has privileges to create user and grant admin privileges
– Astro
Nov 11 at 14:55
None of them has admin privileges. I am not allowed to grant them admin privileges neither (error raised)
– Louis
Nov 11 at 14:57
|
show 1 more comment
up vote
0
down vote
If this is first ever user you're trying to connect in DB, you need to use "Localhost Exception":
The localhost exception allows you to enable access control and then
create the first user in the system. With the localhost exception,
after you enable access control, connect to the localhost interface
and create the first user in the admin database. The first user must
have privileges to create other users, such as a user with the
userAdmin or userAdminAnyDatabase role
Create a user as follows:
use admin;
db.createUser( { user: "userAdminAnyDB", pwd: "password", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] } );
db.auth("userAdminAnyDB", "password")
Once you successfully login using userAdminAnyDB credentials, create a required for your Db deployment.
db.createUser( { user: "admin", pwd: "password", roles: [ { role: "root", db: "mydatabasename" } ] } );
Thank you for your answer ! How do I use Localhost Exception ?
– Louis
Nov 11 at 14:47
Following the first set of commands, I get :Error: couldn't add user: not authorized on mydatabasename to execute command { createUser: "userAdminAnyDB", pwd: "xxx", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
– Louis
Nov 11 at 14:48
I am using mlab and have already 2 users created via mlab but I doubt they have admin privileges. I am not even sure if this is the same users we're talking about via mongo shell
– Louis
Nov 11 at 14:53
If users are already created, you need to login using user who has privileges to create user and grant admin privileges
– Astro
Nov 11 at 14:55
None of them has admin privileges. I am not allowed to grant them admin privileges neither (error raised)
– Louis
Nov 11 at 14:57
|
show 1 more comment
up vote
0
down vote
up vote
0
down vote
If this is first ever user you're trying to connect in DB, you need to use "Localhost Exception":
The localhost exception allows you to enable access control and then
create the first user in the system. With the localhost exception,
after you enable access control, connect to the localhost interface
and create the first user in the admin database. The first user must
have privileges to create other users, such as a user with the
userAdmin or userAdminAnyDatabase role
Create a user as follows:
use admin;
db.createUser( { user: "userAdminAnyDB", pwd: "password", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] } );
db.auth("userAdminAnyDB", "password")
Once you successfully login using userAdminAnyDB credentials, create a required for your Db deployment.
db.createUser( { user: "admin", pwd: "password", roles: [ { role: "root", db: "mydatabasename" } ] } );
If this is first ever user you're trying to connect in DB, you need to use "Localhost Exception":
The localhost exception allows you to enable access control and then
create the first user in the system. With the localhost exception,
after you enable access control, connect to the localhost interface
and create the first user in the admin database. The first user must
have privileges to create other users, such as a user with the
userAdmin or userAdminAnyDatabase role
Create a user as follows:
use admin;
db.createUser( { user: "userAdminAnyDB", pwd: "password", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] } );
db.auth("userAdminAnyDB", "password")
Once you successfully login using userAdminAnyDB credentials, create a required for your Db deployment.
db.createUser( { user: "admin", pwd: "password", roles: [ { role: "root", db: "mydatabasename" } ] } );
answered Nov 11 at 13:22
Astro
2,0312923
2,0312923
Thank you for your answer ! How do I use Localhost Exception ?
– Louis
Nov 11 at 14:47
Following the first set of commands, I get :Error: couldn't add user: not authorized on mydatabasename to execute command { createUser: "userAdminAnyDB", pwd: "xxx", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
– Louis
Nov 11 at 14:48
I am using mlab and have already 2 users created via mlab but I doubt they have admin privileges. I am not even sure if this is the same users we're talking about via mongo shell
– Louis
Nov 11 at 14:53
If users are already created, you need to login using user who has privileges to create user and grant admin privileges
– Astro
Nov 11 at 14:55
None of them has admin privileges. I am not allowed to grant them admin privileges neither (error raised)
– Louis
Nov 11 at 14:57
|
show 1 more comment
Thank you for your answer ! How do I use Localhost Exception ?
– Louis
Nov 11 at 14:47
Following the first set of commands, I get :Error: couldn't add user: not authorized on mydatabasename to execute command { createUser: "userAdminAnyDB", pwd: "xxx", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
– Louis
Nov 11 at 14:48
I am using mlab and have already 2 users created via mlab but I doubt they have admin privileges. I am not even sure if this is the same users we're talking about via mongo shell
– Louis
Nov 11 at 14:53
If users are already created, you need to login using user who has privileges to create user and grant admin privileges
– Astro
Nov 11 at 14:55
None of them has admin privileges. I am not allowed to grant them admin privileges neither (error raised)
– Louis
Nov 11 at 14:57
Thank you for your answer ! How do I use Localhost Exception ?
– Louis
Nov 11 at 14:47
Thank you for your answer ! How do I use Localhost Exception ?
– Louis
Nov 11 at 14:47
Following the first set of commands, I get :
Error: couldn't add user: not authorized on mydatabasename to execute command { createUser: "userAdminAnyDB", pwd: "xxx", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
– Louis
Nov 11 at 14:48
Following the first set of commands, I get :
Error: couldn't add user: not authorized on mydatabasename to execute command { createUser: "userAdminAnyDB", pwd: "xxx", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
– Louis
Nov 11 at 14:48
I am using mlab and have already 2 users created via mlab but I doubt they have admin privileges. I am not even sure if this is the same users we're talking about via mongo shell
– Louis
Nov 11 at 14:53
I am using mlab and have already 2 users created via mlab but I doubt they have admin privileges. I am not even sure if this is the same users we're talking about via mongo shell
– Louis
Nov 11 at 14:53
If users are already created, you need to login using user who has privileges to create user and grant admin privileges
– Astro
Nov 11 at 14:55
If users are already created, you need to login using user who has privileges to create user and grant admin privileges
– Astro
Nov 11 at 14:55
None of them has admin privileges. I am not allowed to grant them admin privileges neither (error raised)
– Louis
Nov 11 at 14:57
None of them has admin privileges. I am not allowed to grant them admin privileges neither (error raised)
– Louis
Nov 11 at 14:57
|
show 1 more comment
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53248634%2fmongodb-admin-user-not-authorized-on-sandbox-plan%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown