Forgot Username / Pwd to CouchDB
Asked Answered
R

11

14

Does anyone know how can I reset the username and password for CouchDB ?

Ronnie answered 19/3, 2012 at 6:19 Comment(4)
Hope this help :- guide.couchdb.org/draft/security.htmlOrban
Re-Installing couchDb worked :-)Ronnie
You don't have anything important in the existing database?Orban
Yes, you are right i was just playing around what all options are there in couchDB. Can you please provide few reference/resource i should look to start with,if you have an idea ?Ronnie
L
21

This worked for me: while couchdb is stopped,

  1. clear the [admin] section in your */etc/couchdb/local.ini
  2. delete the _users.couch database (located in */var/lib/couchdb/)

This will reset the user database to factory defaults (admin party!) and wipe all of couchdb's user accounts. There might be a more subtle way

Lymphosarcoma answered 13/5, 2013 at 14:40 Comment(2)
Works great, thanks a lot. A word of WARNING: This is very useful for development and test databases without any real users. If you do this on a production database all your user accounts will be gone, which is a BAD thing ;)Fluoridate
I did that, how do i restart the couchdb now. It still says you are not an admin when trying to restart db using curlBorscht
E
18

With Apache CouchDB, admin accounts passwords can be changed by editing a file local.ini in the CouchDB config folder (/etc/couchdb/ on most Linux installs). [1]

Look for the [admin] section, which will list the all admin usernames, along with their hashed passwords:

[admin]
foo = -pbkdf2-0e0e83f911c970565fc988497a657bdc21a005e8,19ecef0bea1caf8d7f08fb791379c686,10

Replace the password hash with a new clear text password:

foo = bar

Now restart CouchDB (sudo restart couchdb on Ubuntu). CouchDB will notice the clear text password on startup and automatically replace it with the hashed version.

Eskimo answered 3/6, 2015 at 7:46 Comment(0)
U
6

What I've done it's quite simple. I found out my old username and password here:

/opt/couchbase/var/lib/couchbase/config/config.dat

After that I went to opt/couchbase/bin/ and run

./couchbase-cli cluster-init -c localhost:8091 -u old_user -p old_password --cluster-init-username=new_user --cluster-init-password=new_password

Done! Also you can check this: http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-faq.html

Ushijima answered 21/8, 2012 at 14:14 Comment(3)
With welcome! If it solve your problem, you can accept this answer :)Ushijima
i forgot both id as well as password so what should i do ?Ury
Couchbase is not exactly the same thing as CouchDB.Purveyance
W
3

For mac users, base folder is /Library/Application Support/couchdb

Wexler answered 14/11, 2014 at 17:20 Comment(2)
Or more likely ~/Library/Application Support/couchdb, unless you installed CouchDB as rootStitt
And if you used Homebrew to install it, the local.ini is at /usr/local/etc/couchdb/local.ini.Stitt
C
2

One more point to add ...

If you are running Couch DB on Windows, then probably it was installed as a service and to reset it you need to stop service first, within running service other answers do not work.

http://www.7tutorials.com/what-are-windows-services-what-they-do-how-manage-them

Open Control Panel - Administrative Tools - Services and stop Apache Couch DB

Crumple answered 1/7, 2015 at 14:51 Comment(0)
T
1

for Unix: http://silviud.blogspot.com/2012/10/couchbase-recover-web-console-password.html

/opt/couchbase/bin/erl \
-noinput -eval \
'case file:read_file("/opt/couchbase/var/lib/couchbase/config/config.dat") of {ok, B}  ->     io:format("~p~n", [binary_to_term(B)]) end.' \
-run init stop | grep cred
Tumble answered 2/12, 2014 at 16:13 Comment(1)
This one worked for retrieving my current password without resetting. Thanks ConAim.Krigsman
W
1

You just need to add the username and password in CouchDB local.ini file. You can add as many administrators as you want.

sudo nano /etc/couchdb/local.ini

and in the end of file, add username and password.

And don't forget to restart the CouchDB server. sudo service couchdb restart

Wallywalnut answered 4/6, 2016 at 13:15 Comment(0)
H
0

On Mac OS X, cbreset_password is not in PATH by default, so I've done just:

"/Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin/cbreset_password" 127.0.0.1:8091

...and re-set the password once confirming yes

Horse answered 23/3, 2016 at 23:51 Comment(1)
The cli has since been removed and replaced with couchbase-cli. Use this one instead, supply "newpassword": $> /Applications/Couchbase Server.app/Contents/Resources/couchbase-core/bin/couchbase-cli reset-admin-password --new-password newpasswordMidas
C
0

ubuntu 20.04 :

apt purge couchdb

apt install couchdb

was the only thing that worked for me.

Capps answered 24/2, 2021 at 13:44 Comment(0)
D
0

If using 3.2, CouchDB server administrators and passwords in the last [admins] section that CouchDB finds when loading its ini files:

  • /opt/couchdb/etc/local.ini or
  • /opt/couchdb/etc/local.d/10-admins.ini

Don't forget to restart CouchDB: sudo systemctl restart couchdb (if using ubuntu)

source: https://docs.couchdb.org/en/3.2.0/config/auth.html

Down answered 15/10, 2021 at 23:57 Comment(0)
P
-1

You can change couchbase localhost password by using following steps: 1. Install crul(for windows) 2. curl -u Administrator:password http://localhost:8091/controller/changePassword -d password=admin123

Peti answered 24/8, 2018 at 21:49 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.