# 允许APOC读写磁盘文件apoc.export.file.enabled=trueapoc.import.file.enabled=true# 放开所有apoc存储过程权限(可选,防止权限报错)dbms.security.procedures.unrestricted=apoc.*
创建或者修改conf后要重启数据库
不带上id
CALL apoc.export.cypher.all("full_graph_dump.cypher", { format: "cypher-shell", useTypes: true, exportConstraints: true, exportIndexes: true }) YIELD file, nodes, relationships RETURN file, nodes, relationships;
命令会导出到import文件夹,文件名是full_graph_dump.cypher
带上id
CALL apoc.export.cypher.all("full_graph_dump_with_ids.cypher", {format: "cypher-shell",useTypes: true,exportConstraints: true,exportIndexes: true,writeNodeIds: true, // ✅ 输出 node idwriteRelationshipIds: true // ✅ 输出 rel id}) YIELD file, nodes, relationshipsRETURN file, nodes, relationships;
目标库必须清空:MATCH (n) DETACH DELETE n;
windows cmd 导入数据命令
cypher-shell -a neo4j://localhost:7687 -u neo4j -p "12345678" -f "F:\app\neo4j-community-5.26.13\import\full_graph_dump_with_ids20260903.cypher"