Error connecting python to neo4j using py2neo

前端 未结 1 804
醉酒成梦
醉酒成梦 2021-02-08 01:14

I wrote the following python code to neo4j using py2neo

 from py2neo import Graph
 from py2neo import neo4j,Node,Relationship
 sgraph = Graph()
 alice = Node(\"p         


        
1条回答
  •  北荒
    北荒 (楼主)
    2021-02-08 02:11

    If you're using Neo4j 2.2, authentication for database servers is enabled by default. You need to authenticate before performing further operations. Read documentation.

    from py2neo import authenticate, Graph
    
    # set up authentication parameters
    authenticate("localhost:7474", "user", "pass")
    
    # connect to authenticated graph database
    sgraph = Graph("http://localhost:7474/db/data/")
    
    # create alice and bob
    ...
    

    From the same documentation,

    Py2neo provides a command line tool to help with changing user passwords as well as checking whether a password change is required.

    For a new installation, use:

    $ neoauth neo4j neo4j my-p4ssword
    Password change succeeded
    

    After a password has been set, the tool can also be used to validate credentials

    $ neoauth neo4j my-p4ssword
    Password change not required
    

    0 讨论(0)
提交回复
热议问题