How to reset or change the Neo4j graph database password
Have forgotten your Neo4j database password? Don’t worry, I am sharing two ways to reset or change your Neo4j graph database password.
In some cases simply deleting the existing neo4j database or neo4j installation and installing it again may work. But it’s not an option every time especially when the database already has some data in it.
What are the default username and passwords of the Neo4j database?
If you have recently installed Neo4j and didn’t set any password then your database might have the default username and password. You can try the following credentials:
Username: neo4j
Password: neo4j
If it works then great otherwise you can reset your password using one of the following methods.
Method 1: For Neo4j desktop installation only
Neo4j desktop has become a very popular option to work with the Neo4j graph database. It provides a beautiful interface and is very easy to install Neo4j and other graph applications.
When you create a local database it asks you to enter a password. Most of the time we enter some random password and then don’t remember it later whenever we need it for connecting it.
Resetting or changing the Neo4j password through the Neo4j desktop is quite easy. You just need to open the Neo4j desktop. Go to the database screen and click on the database. It will show an additional section on the right side.
Click on the Details tab and then the Reset DBMS password option, Here you can set a new password.
Method 2: Neo4j Server Installation (Zip/Tar)
Unfortunately, In some cases, we don’t have an option to install the Neo4j desktop. We need to install it through a zip file(Windows) or a tar file(Linux/Mac).
Neo4j stores its auth details in the auth.ini
file. For obvious security reasons Neo4j stores authentication details in the encrypted format so it’s not possible to recover the existing password from this file. The only option we have is to delete this auth file and set the new password when we access the Neo4j after a restart.
- First, stop the Neo4j database if it's running. Auth file is located inside “$NEO4J_HOME/data/dbms/” directory. Navigate to this location.
- Delete the auth file (if you are using Linux and don’t have permission to delete the file. Open the terminal and delete the file using superuser access).
- Restart the neo4j server.
- Open a neo4j browser, and log in with the default username/password: i.e. neo4j/neo4j. It will ask you to set a new password.
This method is also applicable to other distributions and other methods of installation like terminal installation (Including the Neo4j desktop database). You can find the location of a data folder(auth.ini) for your distributions File locations.