databaseneo4jnodessql-deleterelationships

How to delete/create databases in Neo4j?


Is it possible to create/delete different databases in the graph database Neo4j like in MySQL? Or, at least, how to delete all nodes and relationships of an existing graph to get a clean setup for tests, e.g., using shell commands similar to rmrel or rm?


Solution

  • You can just remove the entire graph directory with rm -rf, because Neo4j is not storing anything outside that:

    rm -rf data/*
    

    Also, you can of course iterate through all nodes and delete their relationships and the nodes themselves, but that might be too costly just for testing ...