Back to top
Documentation Command-line tool Start command

Start command

The start command starts a SurrealDB server in memory, on disk, or in a distributed setup.

Make sure you’ve installed SurrealDB — it should only take a second!

Command options

Argument Description
-b / --bind Optional Sets the hostname or ip address to listen for connections on

Default is 0.0.0.0:8000

-l / --log Optional Sets the logging level for the database server

Can be one of error, warn, info, debug, trace, full

-u / --user Optional Sets the master username for the database

Default is root

-p / --pass Optional Sets the master password for the database
-s / --strict Optional Sets whether strict mode is enabled on this database instance
Positional argument
Argument Description
path Optional Sets the database path used for storing data

Can be one of memory, file:<path>, tikv:<addr>, file://<path>, tikv://<addr>

Example usage

To display the current command-line tool version, along with the platform and architecture, in a terminal run the surreal version.

user@localhost % surreal version
[2022-07-28 15:50:34] INFO  surrealdb::iam Root authentication is enabled
[2022-07-28 15:50:34] INFO  surrealdb::dbs Database strict mode is disabled
[2022-07-28 15:50:34] INFO  surrealdb::kvs Starting kvs store in memory
[2022-07-28 15:50:34] INFO  surrealdb::kvs Started kvs store in memory
[2022-07-28 15:50:34] INFO  surrealdb::net Starting web server on 0.0.0.0:8000
[2022-07-28 15:50:34] INFO  surrealdb::net Started web server on 0.0.0.0:8000

Strict mode

SurrealDB supports the ability to startup in strict mode. When running in strict mode, all NAMESPACE, DATABASE, and TABLE definitions will not be created automatically when data is inserted. Instead, if the selected namespace, database, or table has not been specifically defined, then the query will return an error.

user@localhost % surreal start --strict --log debug memory

Command help

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

user@localhost % surreal start --help
Start the database server

Usage: surreal start [OPTIONS] [PATH]

Arguments:
  [PATH]  Database path used for storing data [env: SURREAL_PATH=] [default: memory]

Options:
  -l, --log <LOG>  The logging level for the database server [env: SURREAL_LOG=] [default: info] [possible values: none,
                   full, error, warn, info, debug, trace]
      --no-banner  Whether to hide the startup banner [env: SURREAL_NO_BANNER=]
  -h, --help       Print help (see more with '--help')

Database:
      --tick-interval <TICK_INTERVAL>
          The interval at which to run node agent tick (including garbage collection) [env: SURREAL_TICK_INTERVAL=]
          [default: 10s]
  -s, --strict
          Whether strict mode is enabled on this database instance [env: SURREAL_STRICT=]
      --query-timeout <QUERY_TIMEOUT>
          The maximum duration that a set of statements can run for [env: SURREAL_QUERY_TIMEOUT=]
      --transaction-timeout <TRANSACTION_TIMEOUT>
          The maximum duration that any single transaction can run for [env: SURREAL_TRANSACTION_TIMEOUT=]

Authentication:
  -u, --username <USERNAME>  The username for the initial database root user. Only if no other root user exists [env:
                             SURREAL_USER=] [aliases: user]
  -p, --password <PASSWORD>  The password for the initial database root user. Only if no other root user exists [env:
                             SURREAL_PASS=] [aliases: pass]
      --auth                 Whether to enable authentication [env: SURREAL_AUTH=]

Datastore connection:
      --kvs-ca <KVS_CA>    Path to the CA file used when connecting to the remote KV store [env: SURREAL_KVS_CA=]
      --kvs-crt <KVS_CRT>  Path to the certificate file used when connecting to the remote KV store [env:
                           SURREAL_KVS_CRT=]
      --kvs-key <KVS_KEY>  Path to the private key file used when connecting to the remote KV store [env:
                           SURREAL_KVS_KEY=]

HTTP server:
      --web-crt <WEB_CRT>        Path to the certificate file for encrypted client connections [env: SURREAL_WEB_CRT=]
      --web-key <WEB_KEY>        Path to the private key file for encrypted client connections [env: SURREAL_WEB_KEY=]
      --client-ip <CLIENT_IP>    The method of detecting the client's IP address [env: SURREAL_CLIENT_IP=] [default:
                                 socket] [possible values: none, socket, CF-Connecting-IP, Fly-Client-IP,
                                 True-Client-IP, X-Real-IP, X-Forwarded-For]
  -b, --bind <LISTEN_ADDRESSES>  The hostname or ip address to listen for connections on [env: SURREAL_BIND=] [default:
                                 0.0.0.0:8000]

Capabilities:
  -A, --allow-all [<ALLOW_ALL>...]              Allow all capabilities [env: SURREAL_CAPS_ALLOW_ALL=] [possible values:
                                                true, false]
      --allow-scripting [<ALLOW_SCRIPTING>...]  Allow execution of scripting functions [env: SURREAL_CAPS_ALLOW_SCRIPT=]
                                                [possible values: true, false]
      --allow-guests [<ALLOW_GUESTS>...]        Allow guest users to execute queries [env: SURREAL_CAPS_ALLOW_GUESTS=]
                                                [possible values: true, false]
      --allow-funcs [<ALLOW_FUNCS>...]          Allow execution of all functions. Optionally, you can provide a
                                                comma-separated list of function names to allow [env:
                                                SURREAL_CAPS_ALLOW_FUNC=]
      --allow-net [<ALLOW_NET>...]              Allow all outbound network access. Optionally, you can provide a
                                                comma-separated list of targets to allow [env: SURREAL_CAPS_ALLOW_NET=]
  -D, --deny-all [<DENY_ALL>...]                Deny all capabilities [env: SURREAL_CAPS_DENY_ALL=] [possible values:
                                                true, false]
      --deny-scripting [<DENY_SCRIPTING>...]    Deny execution of scripting functions [env: SURREAL_CAPS_DENY_SCRIPT=]
                                                [possible values: true, false]
      --deny-guests [<DENY_GUESTS>...]          Deny guest users to execute queries [env: SURREAL_CAPS_DENY_GUESTS=]
                                                [possible values: true, false]
      --deny-funcs [<DENY_FUNCS>...]            Deny execution of all functions. Optionally, you can provide a
                                                comma-separated list of function names to deny [env:
                                                SURREAL_CAPS_DENY_FUNC=]
      --deny-net [<DENY_NET>...]                Deny all outbound network access. Optionally, you can provide a
                                                comma-separated list of targets to deny [env: SURREAL_CAPS_DENY_NET=]