Neo4j入门篇-从Mysql导出csv文件导入到Neo4j

简介

Neo4j的导入导出。

Mysql导出CSV

1.命令行方式。

不过下面要开启secure_file_priv='';才行

具体参考

The MySQL server is running with the --secure-file-priv option so it cannot execute this statement_孤岛残影的博客-CSDN博客

select * from test.table1
into outfile '/table1.csv' fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n';

2.Navicat导出。

Neo4j导入数据 

1.只是查询。

#在导入的地方创建文件夹
mkdir  /root/neo4j/neo4j-community-5.5.0/import/root/
load csv from 'file:///root/table1.csv' as line 
return line;

2.导入到数据库。

load csv from 'http://we-yun.com/neo4jguide/movie.csv' as line 
create (:Movie {title: line[0], released:line[1] , tagline: line[2]});
#也可以先下载下来导入
链接:https://pan.baidu.com/s/1vLKXV_8r2YA_VThbV-eFQw 
提取码:yyds 
--来自百度网盘超级会员V5的分享
load csv from 'file:///root/movie.csv' as line 
create (:Movie {title: line[0], released:line[1] , tagline: line[2]});
match (n) return n;

在导入大量文件的时候可以使用

 

猜你喜欢

转载自blog.csdn.net/S1124654/article/details/129586195
今日推荐