You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
424 B
16 lines
424 B
# pip install neo4j
|
|
from neo4j import GraphDatabase
|
|
|
|
# 连接配置
|
|
neo4j_url = "bolt://localhost:7687" # 建议使用bolt协议
|
|
neo4j_user = "neo4j"
|
|
neo4j_pwd = "your_password"
|
|
|
|
# 创建驱动
|
|
with GraphDatabase.driver(neo4j_url, auth=(neo4j_user, neo4j_pwd)) as driver:
|
|
# 验证连接
|
|
driver.verify_connectivity()
|
|
print("成功连接到Neo4j数据库")
|
|
neo4j_user = "neo4j"
|
|
neo4j_pwd = "neo4j"
|