generalneo4j

Connect to Neo4j

Connect using the server console

You can connect to Neo4j from the same server where it is installed with the Neo4j Admin client tool.

Execute the following command at the server console:

$ neo4j-admin COMMAND

This command allows you to manage the Neo4j installation. For example, it can be used to retrieve information about the database and dump its contents, as shown in the example below using the graph.db database:

$ sudo /opt/bitnami/ctlscript.sh stop
$ sudo neo4j-admin dump --to=/tmp/dump.db

Execute the neo4j-admin help command to check the available commands and Neo4j environment variables. You should see output similar to this:

Connect to Neo4j

Connect using a browser

If you wish to connect to Neo4j using a browser, a double SSH tunnel is required, as the required ports are not open in the firewall by default. You will require:

  • An SSH tunnel from 7474 to localhost:7474 (for HTTP connections)
  • An SSH tunnel from 7687 to localhost:7687 (for Bolt protocol connections)

The images below demonstrate the connections in action:

Connect to Neo4j

Connect to Neo4j

Operate with the Neo4j database

Neo4j has its own command-line tool to operate with its database from the same server where it is installed. Cypher Shell allows you to connect to the database, query data, define schema, or perform administrative tasks. Cypher Shell communicates via the encrypted binary protocol Bolt.

  • To connect to the database using the Cypher Shell CLI execute the command below. Remember to replace the PASSWORD placeholder with your application password.

      $ cypher-shell -u neo4j -p PASSWORD
    
  • Once you connect to the database, check the available commands by running the :help; command:

    Connect to Neo4j database

Last modification December 21, 2022