赞
踩
问题1
py2neo.errors.ConnectionUnavailable: Connection has been closed
问题2
neo4j Failed authentication attempt for ‘meter’ from 127.0.0.1
问题3
py2neo.errors,ClientError: [Security.Unauthorized] Invalid username or password.
作者:xiao黄
博客地址:https://blog.csdn.net/Python_Matlab?type=blog
为解决上述问题,博主通过各种方式,寻求帮助,最终得到解决。
本人的环境为Python3.7
Neo4j Desktop 1.2.4
py2neo 2021.2.3
graph = Graph("http://localhost:7474",user= "meter",password = "123456")
改为graph = Graph("http://localhost:7474",auth=( "meter","123456"))
;或者在后面添加name=“neo4j”,如:graph = Graph("http://localhost:7474",auth=( "meter","123456"),name="neo4j")
等。在进行一番尝试后,无果。查看日记,发现这里对应的是上述问题2,在python终端则会显示问题1和问题3,对应不同的写法,一个用7474,一个用7687
解决办法如下
dbms.security.auth_enabled=false
通过小例子证实
from py2neo import Graph
#连接图数据库
graph = Graph("http://localhost:7474",user= "meter",password = "123456")
# graph = Graph("bolt://localhost:7687", auth=("meter", "123456"))
graph.delete_all()
cypher = "create (n:person {name : '老大',age : 18,length : 168})"
graph.run(cypher)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。