2024-01-30 19:15:44 -05:00
W## Installation
2024-01-01 23:11:40 -05:00
1. Install
- `curl -sSf https://install.surrealdb.com | sh`
2. Move into `$PATH`
- `sudo mv /home/wyatt/.surreal/surreal /usr/local/bin`
2024-01-01 22:19:40 -05:00
## Syntax
`surreal ...`
2024-01-01 22:22:40 -05:00
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
2024-01-01 22:27:40 -05:00
Typically I have two commands I will perform when I start the database*:
2024-01-01 22:26:40 -05:00
2024-01-01 22:25:40 -05:00
Option one: `surreal start --auth --user root --pass root`
Option two: `surreal start --auth --user root --pass root file://path/to/database`
2024-01-01 22:26:40 -05:00
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...
2024-01-01 22:55:40 -05:00
*- I also use Docker (or some other OCI runtime like Podman) to run SurrealDB. It is in fact my preferred method -*
2024-01-01 22:26:40 -05:00
## Importing an existing database
2024-01-01 22:28:40 -05:00
2024-01-01 22:33:40 -05:00
Imports deal with SurQL files, similar to SQL files, filled with statements that SurrealDB will read and be ready when you start the database
2024-01-01 22:30:40 -05:00
2024-01-01 22:33:40 -05:00
Example: `surreal import -e http://127.0.0.1:8002 --user root --pass root --ns test --db test export.surql`
2024-01-01 22:31:40 -05:00
2024-01-01 23:00:40 -05:00
The HTTP protocol must be used in the export process
2024-01-01 22:32:40 -05:00
## Exporting a running database
2024-01-01 22:33:40 -05:00
Exporting throws everything into a SurQL file, used for analysis and importing (for later!)
2024-01-01 22:59:40 -05:00
Example: `surreal export -e http://localhost:8002 --user root --pass root --ns test --db test export.surql`
2024-01-01 23:00:40 -05:00
The HTTP protocol must be used in the export process
## SQL mode
2024-01-01 23:10:40 -05:00
SurrealDB has a SQL-like (not compatible with ANSI SQL) language one can use for running (or piping) SurrealQL queries. You can find the syntax and some examples over [here ](./Syntax ).