Files
notes/Databases/SurrealDB/Command line interface.md

36 lines
1.5 KiB
Markdown

## Installation
`curl -sSf https://install.surrealdb.com | sh`
`sudo mv /home/wyatt/.surreal/surreal /usr/local/bin`
## Syntax
`surreal ...`
The dots represent a subcommand that is supposed to present. Almost if not all commands (and subcommands) always come with a `--help` flag so you can get a reference on what the command does
## Starting the database
Typically I have two commands I will perform when I start the database*:
Option one: `surreal start --auth --user root --pass root`
Option two: `surreal start --auth --user root --pass root file://path/to/database`
Option two I'm still figuring out. I just export it once I'm done and then import the export once I'm ready to begin again. Speaking of...
*- I also use Docker (or some other OCI runtime like Podman) to run SurrealDB. It is in fact my preferred method -*
## Importing an existing database
Imports deal with SurQL files, similar to SQL files, filled with statements that SurrealDB will read and be ready when you start the database
Example: `surreal import -e http://127.0.0.1:8002 --user root --pass root --ns test --db test export.surql`
The HTTP protocol must be used in the export process
## Exporting a running database
Exporting throws everything into a SurQL file, used for analysis and importing (for later!)
Example: `surreal export -e http://localhost:8002 --user root --pass root --ns test --db test export.surql`
The HTTP protocol must be used in the export process
## SQL mode
SurrealDB has a SQL-like (not compatible with ANSI SQL)