You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过mgconsole向WSL中运行的Memgraph导入.cypherl格式数据

导入.cypherl数据到WSL Ubuntu中的Memgraph(无需Memgraph Lab)

方法1:通过mgconsole交互式导入

  • 确认Memgraph服务状态并启动(若未运行):
    sudo systemctl status memgraph
    sudo systemctl start memgraph
    
  • 启动Memgraph自带的命令行客户端:
    mgconsole
    
  • 在Cypher提示符下,执行导入命令(替换为你的.cypherl文件绝对路径):
    SOURCE "/home/your-user/data/your-data.cypherl";
    
  • 验证导入结果:
    MATCH (n) RETURN count(n);
    

方法2:终端管道非交互式导入

无需进入交互模式,直接通过管道执行整个.cypherl文件:

mgconsole < "/path/to/your-data.cypherl"

方法3:使用memgraph-import批量导入(需停服务)

  • 先停止Memgraph服务:
    sudo systemctl stop memgraph
    
  • 执行导入命令:
    memgraph-import --cypher-file "/path/to/your-data.cypherl"
    
  • 重新启动服务:
    sudo systemctl start memgraph
    

常见问题处理

  • 若mgconsole提示连接失败,检查端口是否被修改,指定端口连接:
    mgconsole --port 自定义端口号
    
  • 确保文件路径为WSL格式:使用WSL内部路径(如/home/xxx/)或Windows挂载路径(如/mnt/c/Users/xxx/),不要直接使用Windows的C:\路径。

内容的提问来源于stack exchange,提问作者KWriter

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 21:01:40