How to reset / clear / delete neo4j database

cypherdatabaseneo4j

We can delete all nodes and relationships by following query.

MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r

But newly created node get internal id as ({last node internal id} + 1) . It doesn't reset to zero.

How can we reset neo4j database such as newly created node will get id as 0?

From 2.3, we can delete all nodes with relationships,

MATCH (n)
DETACH DELETE n

Best Answer

Shut down your Neo4j server, do a rm -rf data/graph.db and start up the server again. This procedure completely wipes your data, so handle with care.

Related Topic