Skip to main content

Export command

The export command exports a SurrealQL script file from a local or remote SurrealDB database server.

BEFORE YOU START : Make sure you’ve installed SurrealDB — it should only take a second!

Command options


-e / --endpoint / --conn OPTIONAL

Sets the url of the database server to connect to

-u / --user REQUIRED

Sets master username for the database

-p / --pass REQUIRED

Sets master password for the database


Sets the desired namespace in which to export data


Sets the desired database into which to export data

Positional argument


Sets the the path to the file which should be exported

Example usage

To perform a SurrealQL database export into a local file, in a terminal run the surreal export command with the required arguments.

surreal export --conn http://localhost:8000 --user root --pass root --ns test --db test export.surql

Command help

To see the help information and usage instructions, in a terminal run the surreal export --help command without any further arguments. This command gives general information on the arguments, inputs, and additional options for the export command.

surreal export --help

The output of the above command :

Export a SurrealQL script into an existing database


surreal export [OPTIONS] <file>

<file> Path to the sql file to export

-e, --endpoint, --conn <conn> Remote database server URL to connect to

--db <db> The database to export the data into

-h, --help Print help information

--ns <ns> The namespace to export the data into

-p, --pass <pass> Database authentication password to use when connecting
[default: root]

-u, --user <user> Database authentication username to use when connecting [default: root]