For the purposes of getting started with SurrealDB quickly, we will start an in-memory database which does not persist data on shutdown. This database is great for development and testing.
surreal start memory
SurrealDB will assume memory
in case this argument is not passed in, so the following command is identical to the above.
surreal start
The default logging level for the database server is info
, resulting in any informational logs to be output to the standard output. To control the logging verbosity, specify the --log
argument. The following command starts the database with debug
level logging, resulting in more logs being output to the terminal. If extra verbosity is not needed, specify a lower level or simply remove the flag, which will default to the info
level.
surreal start --log debug memory
In versions of SurrealDB before 2.0
, anyone would be able to connect to this server to begin running queries. However, SurrealDB since version 2.0
runs with authentication by default. In order to disable it, the --unauthenticated
flag can be passed in.
surreal start --unauthenticated memory
However, for anything but simple testing, it is better to configure your initial root-level user by setting the --user
and --pass
command-line arguments. The following command starts the database with a top-level user named root
with a password also set to root
.
surreal start --user root --pass root memory
The previous command will bootstrap the server with the provided initial credentials, you can now remove those args and rely on DEFINE USER to change the password or create more users.
surreal start --user username --pass 123456 memory
In order to change the default port that SurrealDB uses for web connections and from database clients you can use the --bind
argument. The following command starts the database on port 8080
.
surreal start --user root --pass root --bind 0.0.0.0:8080 memory
After running the above command, you should see the SurrealDB server startup successfully.
surreal start --user root --pass root --bind 0.0.0.0:8080 memory 2023-08-30T15:06:34.788821Z INFO surrealdb::kvs::ds: Starting kvs store in memory 2023-08-30T15:06:34.788859Z INFO surrealdb::kvs::ds: Started kvs store in memory 2023-08-30T15:06:34.789222Z INFO surrealdb::kvs::ds: Initial credentials were provided and no existing root-level users were found: create the initial user 'root'. 2023-08-30T15:06:35.205123Z INFO surrealdb::node: Started node agent 2023-08-30T15:06:35.205827Z INFO surrealdb::net: Started web server on 0.0.0.0:8080
For details on the different commands available, visit the CLI tool documentation.