Linux command
cypher-shell 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Connect to Neo4j
cypher-shell
Connect with credentials
cypher-shell -u [username] -p [password]
Connect to specific address
cypher-shell -a [neo4j://localhost:7687]
Execute a query
cypher-shell "MATCH (n) RETURN count(n)"
Execute queries from file
cypher-shell -f [queries.cypher]
Connect to specific database
cypher-shell -d [neo4j]
Output in plain format
cypher-shell --format plain "MATCH (n) RETURN n LIMIT 5"
说明
cypher-shell is the command-line interface for executing Cypher queries against Neo4j graph databases. Cypher is Neo4j's declarative query language for creating, reading, updating, and deleting graph data. In interactive mode, it provides a REPL environment for exploring graph data, with command history and basic editing. Non-interactive mode executes queries and returns results, useful for scripting and automation. The shell supports transaction management, allowing multiple statements to be executed atomically. It can output results in various formats suitable for human reading or machine parsing.
参数
- -a _ADDRESS_, --address _ADDRESS_, --uri _ADDRESS_
- Connection address (default: neo4j://localhost:7687).
- -u _USER_, --username _USER_
- Neo4j username.
- -p _PASSWORD_, --password _PASSWORD_
- Neo4j password.
- -d _DATABASE_, --database _DATABASE_
- Database to connect to.
- -f _FILE_, --file _FILE_
- Execute Cypher queries from file.
- --format _FORMAT_
- Output format: auto, verbose, plain (default: auto).
- --encryption _MODE_
- Encryption mode: true, false, default.
- -P _PARAM_, --param _PARAM_
- Define session parameters (may be repeated).
- --non-interactive
- Force non-interactive (batch) mode.
- --fail-fast
- Exit on first error when processing a file.
- --fail-at-end
- Report all errors after processing a file.
- --change-password
- Change the user password and exit.
- -v, --version
- Display version information.
- --help
- Display help information.
FAQ
What is the cypher-shell command used for?
cypher-shell is the command-line interface for executing Cypher queries against Neo4j graph databases. Cypher is Neo4j's declarative query language for creating, reading, updating, and deleting graph data. In interactive mode, it provides a REPL environment for exploring graph data, with command history and basic editing. Non-interactive mode executes queries and returns results, useful for scripting and automation. The shell supports transaction management, allowing multiple statements to be executed atomically. It can output results in various formats suitable for human reading or machine parsing.
How do I run a basic cypher-shell example?
Run `cypher-shell` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a _ADDRESS_, --address _ADDRESS_, --uri _ADDRESS_ do in cypher-shell?
Connection address (default: neo4j://localhost:7687).