Neo4j create new user
To create a new user in Neo4j, you can use the following methods:
Method 1: Using the Neo4j Browser
- Open the Neo4j Browser by navigating to
http://localhost:7474
(or the URL of your Neo4j instance). - Log in with your existing credentials.
- Click on the "Users" tab in the top navigation bar.
- Click on the "Create User" button.
- Fill in the required information, such as username, password, and email address.
- Click "Create" to create the new user.
Method 2: Using the Neo4j CLI
- Open a terminal or command prompt.
- Run the following command to create a new user:
neo4j-shell -username <existing_username> -password <existing_password> -c "CREATE USER <new_username> WITH PASSWORD '<new_password>'"
Replace
<existing_username>
and<existing_password>
with your existing Neo4j credentials, and<new_username>
and<new_password>
with the desired credentials for the new user.
Method 3: Using the Neo4j REST API
- Send a POST request to the Neo4j REST API endpoint
/db/data/user
with the following JSON payload:{ "username": "<new_username>", "password": "<new_password>", "email": "<new_email>" }
Replace
<new_username>
,<new_password>
, and<new_email>
with the desired credentials for the new user.
For example, using curl
:
curl -X POST \
http://localhost:7474/db/data/user \
-H 'Content-Type: application/json' \
-d '{"username": "newuser", "password": "newpassword", "email": "[email protected]"}'
Note: Make sure to replace localhost:7474
with the URL of your Neo4j instance.
After creating the new user, you can log in with the new credentials to access the Neo4j Browser or use the new credentials to connect to the Neo4j instance using the Neo4j CLI or other tools.