1.?進(jìn)入要安裝neo4j的ubuntu環(huán)境。
2.?添加Debian資源庫(kù)。
java 1.8.xx版本對(duì)應(yīng)neo4j 3.xx版本(jdk 11版本對(duì)應(yīng)neo4j 4.xx版本):
(1)wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add -
(2)echo 'deb https://debian.neo4j.com stable 3.5' | sudo tee /etc/apt/sources.list.d/neo4j.list(或者:echo 'deb https://debian.neo4j.com stable 4.4' | sudo tee /etc/apt/sources.list.d/neo4j.list)
(3)sudo apt-get update
3. 安裝社區(qū)版neo4j:
sudo apt-get install neo4j
4.?此時(shí)可查看其運(yùn)行狀態(tài):
sudo systemctl status neo4j.service
5.?設(shè)置為在系統(tǒng)重新啟動(dòng)時(shí)啟動(dòng):
(1)sudo systemctl enable neo4j.service
(2)sudo systemctl start neo4j.service
*(3)sudo systemctl status neo4j.service
6.?連接和配置neo4j。
(1)測(cè)試連接到數(shù)據(jù)庫(kù):
cypher-shell。
默認(rèn)neo4j?用戶名和?neo4j?密碼。
:exit。
7.?修改密碼。
~$ cypher-shell
username: neo4j
password: neo4j
neo4j> CALL dbms.changePassword('yournewpassword');
0 rows available after 24 ms, consumed after another 0 ms
neo4j>?
8.?使用neo4j。
$ cypher-shell
username: neo4j
password: ********
Connected to Neo4j 3.5.35 at bolt://localhost:7687 as user neo4j.
Type :help for a list of available commands or :exit to exit the shell.
Note that Cypher queries must end with a semicolon.
neo4j>
登錄到?neo4j后,就可以通過(guò)命令行進(jìn)行查詢以及將實(shí)體和關(guān)系添加到數(shù)據(jù)庫(kù)中了。
neo4j>?
密碼輸入錯(cuò)誤會(huì)提示:
username: neo4j
password: *****
The client is unauthorized due to authentication failure.
9.關(guān)閉和啟動(dòng)。
sudo neo4j stop
sudo neo4j start
10.?新建和切換數(shù)據(jù)庫(kù)。
社區(qū)版不支持用create database yourdbname創(chuàng)建。
社區(qū)版只可同時(shí)打開(kāi)一個(gè)數(shù)據(jù)庫(kù),但可以存在多個(gè)數(shù)據(jù)庫(kù)。
在/etc/neo4j/neo4j.conf中做如下修改:
#dbms.default_database=neo4j
dbms.default_database=neo4yours
對(duì)于社區(qū)版,此修改可實(shí)現(xiàn)數(shù)據(jù)庫(kù)的切換,每次切換均需修改,use database命令不可用。
關(guān)閉neo4j并重啟,neo4j會(huì)自動(dòng)創(chuàng)建neo4yours:
cd ../bin
./neo4j restart
11. Web Browser。
服務(wù)處于開(kāi)啟狀態(tài):
http://localhost:7474
Start querying
12.?Desktop。
服務(wù)處于開(kāi)啟狀態(tài):
bolt://localhost:7687
Connect -> Open ->?Start querying
13. 試用。
match(n) return n
14. Python?連接、清空、導(dǎo)入數(shù)據(jù)。
from py2neo import Graph, Node, Relationship,NodeMatcher
graph = Graph('http://localhost:7474', auth=('neo4j', '********'))
清空數(shù)據(jù)庫(kù):
graph.delete_all()
導(dǎo)入數(shù)據(jù):
s_node=Node("實(shí)體類型", name=v1)
e_node=Node("實(shí)體類型", name=v2)
r=Relationship(s_node, v3, e_node)
graph.merge(s_node, "實(shí)體類型", "name")
graph.merge(e_node, "實(shí)體類型", "name")
graph.merge(r, "Label", "name")
References:
https://blog.csdn.net/BigData_Mining/article/details/122308250文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-765515.html
如何在Ubuntu20.04上安裝和配置Neo4j - 菜鳥(niǎo)教程
【精選】圖數(shù)據(jù)庫(kù)-Neo4j(六):創(chuàng)建/切換數(shù)據(jù)庫(kù)(不刪舊)【社區(qū)版只能同時(shí)一個(gè)數(shù)據(jù)庫(kù)活動(dòng),修改neo4j.conf默認(rèn)/活動(dòng)數(shù)據(jù)庫(kù)為此時(shí)需要用到的數(shù)據(jù)庫(kù)名】【Neo4.x企業(yè)版可以同時(shí)多個(gè)活動(dòng)數(shù)據(jù)庫(kù)】_neo4j創(chuàng)建數(shù)據(jù)庫(kù)-CSDN博客文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-765515.html
到了這里,關(guān)于Neo4j在Ubuntu 20.04上安裝、配置以及Python連接使用 - Neo4j的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!