当前位置:网站首页>Migrate data from Mysql to neo4j database
Migrate data from Mysql to neo4j database
2022-07-05 12:25:00 【Nat_ Jst】
Preface : I have read several other people's tutorials, and there are some mistakes , Record the method of ultimate success .
Reference tutorial :
transfer MySQL Data to Neo4j
neo4j install APOC plug-in unit
Method :
One : Download required jar package
apoc Download address
mysql-connector-java Download address
Put it in the directory below , Be careful : my Neo4j The version is 3.5.26, Corresponding apoc The version is also 3.5.*, Downloaded the version in the reference tutorial , When the service is started , Service failed to start .
Two 、 Modify the configuration file

① modify
# Whether requests to Neo4j are authenticated.
# To disable authentication, uncomment this line
#https://www.cnblogs.com/jpfss/p/11365342.html
dbms.security.auth_enabled=true
② add to
# Wen Chu
dbms.security.procedures.unrestricted=apoc.*
apoc.import.file.enabled=true
# At the end of the article
dbms.memory.pagecache.size=10g
dbms.memory.heap.initial_size=1g
dbms.memory.heap.max_size=4g
3、 ... and 、 Restart the service
cmd The command line enters the following path to execute :
neo4j restart

Four 、 see apoc Whether the installation was successfully opened
open http://localhost:7474/
return apoc.version()

The appearance of the version number indicates that the plug-in has been successfully installed !
5、 ... and 、 Migrating data
( Optional : Empty neo4j Database data )
There are two tables in my database , One stores node information , A storage side ( Relationship ) Information about .
5.1 Migrate nodes
Node table :

stay Neo4j Statement executed in :
CALL apoc.load.jdbc('jdbc:mysql://localhost:3306/ Database name ?user=root&password=root&useUnicode=true&characterEncoding=utf8&serverTimezone=UTC', 'SELECT * FROM `node Table name `') YIELD row CREATE (n:Node {id: row.id, name: row.name, classname: row.classname})
Node Represents the node name ( type ), Can be for other , Such as Person etc. .
attribute :{id: row.id, name: row.name, classname: row.classname}
5.2 Migration relationship
A relational table :
CALL apoc.load.jdbc('jdbc:mysql://localhost:3306/ Database name ?user=root&password=root&useUnicode=true&characterEncoding=utf8&serverTimezone=UTC', 'SELECT * FROM `link Table name `') YIELD row match (n:Node {id: row.from_node_id}),(m:Node{id:row.to_node_id}) create (n)-[r:from_to{id:row.id,classname:row.classname,kind:row.kind,from_node_id:row.from_node_id,to_node_id:row.to_node_id}]->(m)
Be accomplished !
边栏推荐
- 2022年国内云管平台厂商哪家好?为什么?
- 一款新型的智能家居WiFi选择方案——SimpleWiFi在无线智能家居中的应用
- JS for loop number exception
- MySQL transaction
- Want to ask, how to choose a securities firm? Is it safe to open an account online?
- 手机 CPU 架构类型了解
- Simple production of wechat applet cloud development authorization login
- Interviewer: is acid fully guaranteed for redis transactions?
- What is digital existence? Digital transformation starts with digital existence
- Application of a class of identities (vandermond convolution and hypergeometric functions)
猜你喜欢

Master the new features of fluent 2.10

Four operations and derivative operations of MATLAB polynomials
![[untitled]](/img/56/6a9a4bcab6503872942fff7a365def.jpg)
[untitled]

Check the debug port information in rancher and do idea remote JVM debug
Why do you always fail in automated tests?

What is digital existence? Digital transformation starts with digital existence

Error modulenotfounderror: no module named 'cv2 aruco‘

MySQL index - extended data

The evolution of mobile cross platform technology

Read and understand the rendering mechanism and principle of flutter's three trees
随机推荐
嵌入式软件架构设计-消息交互
ZABBIX ODBC database monitoring
PIP command reports an error pip is configured with locations that requires tls/ssl problems
Which domestic cloud management platform manufacturer is good in 2022? Why?
1. Laravel creation project of PHP
Master the new features of fluent 2.10
Thoughts and suggestions on the construction of intelligent management and control system platform for safe production in petrochemical enterprises
abap查表程序
Matlab imoverlay function (burn binary mask into two-dimensional image)
Yum only downloads the RPM package of the software to the specified directory without installing it
ZABBIX agent2 monitors mongodb nodes, clusters and templates (official blog)
MySQL function
mmclassification 训练自定义数据
ZABBIX customized monitoring disk IO performance
MySQL index - extended data
Learn memory management of JVM 01 - first memory
POJ-2499 Binary Tree
Redis highly available sentinel cluster
About cache exceptions: solutions for cache avalanche, breakdown, and penetration
Video networkstate property