35

Because this question was never answered, I was hoping someone could help me reset the password to connect to my neo4j password (at localhost:7474). Zachary wrote a post on solving this by someone restarting the service using:

sudo service neo4j-service restart

but I did not find this helpful. In the terminal, I ran bin/neo4j restart (which I think is the equivalent command), and was not able to reset my password.

Community
  • 1
  • 1
NumenorForLife
  • 1,736
  • 8
  • 27
  • 55

6 Answers6

70

Depending on environment and installation type you need to look for a file named auth under directory dbms and remove it.

In MacOs, for dmg installations (adjust for custom locations):

/Users/xyz/Documents/Neo4j/default.graphdb/dbms/auth

or (homebrew install)

/usr/local/Cellar/neo4j/x.x.x/libexec/data/dbms/auth

Windows users should look for same file in the default.graphdb/dbms directory.

In Ubuntu

/var/lib/neo4j/data/dbms/auth

In docker containers

/var/lib/neo4j/data/dbms/auth

Alternatively, you might choose to disable auth in the configuration file, usually found in

MacOs:

/Users/xyz/Documents/Neo4j/.neo4j.conf

or

/usr/local/Cellar/neo4j/x.x.x/libexec/conf

and set this property to false

dbms.security.auth_enabled=false

After doing this, you need to restart the server for changes to make effect, you will be asked for a new password.

ErnestoE
  • 1,264
  • 13
  • 20
  • 5
    On Ubuntu: `sudo rm /var/lib/neo4j/data/dbms/auth` - although it never hurts to look before you leap. – Travis Sep 27 '15 at 01:42
  • 3
    Just add a reminder for others. After deleting the `auth` file, you need to restart the server and then set a new password. – JavaNoScript Sep 30 '16 at 09:51
  • It could be in `/data/dbms` dir if you start it with docker – vladkras Mar 27 '17 at 16:52
  • With "neo4j-desktop-offline-1.1.8.dmg" installed and launched, it never asked me for creating a pw. Also, there is no Neo4j folder under Documents. – akauppi Jul 30 '18 at 07:58
  • What if it is an instance of a cluster?? auth file is not automatically created – adil ameen Sep 07 '18 at 11:31
9

In window machine, I deleted the auth file at following path :

Users\systemUser\Documents\Neo4j\default.graphdb\data\dbms and then I restarted the neo4j server.

Navigate to http://localhost:7474. It will ask you to enter the password for user neo4j. Enter default password (neo4j)

After this you will be navigated to change password screen. Change your password.

Note : for other operating systems auth file path may be different

Karan Bir
  • 351
  • 4
  • 13
  • thanks to you I could fin my path. Windows10: C:\Users\(userName)\.Neo4jDesktop\relate-data\dbmss\dbms-4de68f86-7bd7-42cf-aab8-d70a3103cba6\data\dbms – Dariusz Legizynski Mar 01 '21 at 07:01
5

I am running version 4.0.7. Many answers I found on the internet state "Delete /data/dbms/auth". That does not work for 4.0.7, that file does not exist.

I followed these instructions, and they worked. https://neo4j.com/docs/operations-manual/current/configuration/password-and-user-recovery/

Mainly do this:

  1. Stop neo4j if its running

  2. edit /etc/neo4j/neo4j.conf, and uncomment dbms.security.auth_enabled=false

  3. connect to the database and run

    ALTER USER neo4j SET PASSWORD 'mynewpass'; :exit

  4. Stop neo4j

  5. comment out the dbms.security.auth_enabled=false

  6. start neo4j

Dave
  • 727
  • 1
  • 9
  • 20
2

For the Mac, I had to remove ~/Documents/Neo4j/default.graphdb/data/dbms/auth

Then restart the server, and reset the password.

Will
  • 812
  • 3
  • 11
  • 21
0

In addition to deleting the auth file, sudo rm /data/dbms/auth, I also had to set up local port forwarding for the browser port 7474 and the bolt connector port 7687. This is due to the outbound firewall for browsers of the network I am using.

colby-ham
  • 457
  • 9
  • 13
0

On a DB and on a Windows installation of Neo4j Desktop (others can chime in if it works on Mac and Lnx), you can simply:

  1. stop the DB,
  2. click anywhere along the ribbon with the DB name and the "Open" button (this is hidden until you do a mousehover on this area) - I just click the name as there's no event on that label control and
  3. you'll see along the RHS, the "Details", "Pluggins" and "Upgrade" options - select the "Details".
  4. at the bottom, open the "Reset DBMS password" and you're good to go.

It's a bit scary as you don't need to know the original pwd...but since this should be used only for dev tasks and/or by the dba, that seems good for my lazy needs :)

HTH.

LPLP1313
  • 49
  • 2