如何在 Neo4j 中删除/创建数据库? [英] How to delete/create databases in Neo4j?
问题描述
是否可以像在 MySQL 中一样在图形数据库 Neo4j 中创建/删除不同的数据库?或者,至少,如何删除现有图形的所有节点和关系以获得干净的测试设置,例如,使用类似于 rmrel
或 rm
的 shell 命令?
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
?
推荐答案
您可以使用 rm -rf
删除整个图形目录,因为 Neo4j 不会在此之外存储任何内容:
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 ...
这篇关于如何在 Neo4j 中删除/创建数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!