# In-memory

For the purposes of getting started with SurrealDB quickly, we will start an in-memory database which does not persist data on shutdown.

**SurrealDB 3.x**

```bash
surreal start mem
```

As SurrealDB runs with in-memory storage by default, the following command is identical to the above.

```bash
surreal start
```

The default logging level for the database server is `info`. 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.

```bash
surreal start --log debug memory
```

The SurrealDB server runs with authentication by default. In order to disable it, the `--unauthenticated` flag can be passed in.

```bash
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 set to `secret`.

```bash
surreal start --user root --pass secret
```

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`.

```bash
surreal start --user root --pass secret --bind 0.0.0.0:8080
```

After running the above command, you should see the SurrealDB server start up successfully.

```bash
surreal start --user root --pass secret --bind 0.0.0.0:8080
```
```text title="Output"
2026-03-05T03:15:21.128111Z  INFO surrealdb::core::kvs::ds: Starting kvs store in memory
2026-03-05T03:15:21.129330Z  INFO surrealdb::core::kvs::ds: Started kvs store in memory
2026-03-05T03:15:21.130104Z  INFO surreal::dbs: Operation succeeded operation="check_version" attempts=1
2026-03-05T03:15:21.130137Z  INFO surrealdb::core::kvs::ds: This is a new SurrealDB instance. Initialising default namespace 'main' and database 'main'
2026-03-05T03:15:21.131439Z  INFO surreal::dbs: Operation succeeded operation="initialise_defaults" attempts=1
2026-03-05T03:15:21.131465Z  INFO surreal::dbs: Initialising credentials user=root
2026-03-05T03:15:21.131495Z  INFO surrealdb::core::kvs::ds: Credentials were provided, and no root users were found. The root user 'root' will be created
```

For details on the different commands available, visit the [CLI tool documentation](/docs/reference/cli/surrealdb-cli/overview.md).

## About SurrealMX

Since SurrealDB 3.0, in-memory storage runs on a backend called [SurrealMX](https://github.com/surrealdb/surrealmx) that also allows for [versioned queries](/docs/reference/query-language/statements/select.md#the-version-clause) and [persistent storage](/docs/reference/cli/surrealdb-cli/commands/start.md#supported-parameters-for-memory-surrealmx) as a snapshot or AOL (append-only log).

SurrealMX uses an innovative commit pipeline designed around a key insight: by splitting the commit process into discrete, narrowly-scoped stages, multiple transactions can progress through different stages of the pipeline concurrently, much like instruction pipelining in a CPU.

Opting in to versioning and/or persistent storage is done by adding a path to the area to store the data as well as parameters to customise the type of storage and its behaviour. For example, the following command will start an in-memory server with versioning enabled that stores its data in in snapshots taken every 60 seconds.

```bash
surreal start --user root --pass secret "mem://tmp/data?versioned=true&snapshot=60s"
```

Persistent storage is similar to that used in a product like Redis in that it is a convenience to allow in-memory data to persist, but not a true primary solution for long-term storage. For example, all the data stored must also be able to fit in RAM, and each snapshot is essentially a backup of the entire database. In addition, the persisted data is not compacted as is the case with RocksDB and SurrealKV. For more details on these parameters, see [this page](/docs/reference/cli/surrealdb-cli/commands/start.md#supported-parameters-for-memory-surrealmx) for the `start` command.

The following chart sums up the durability guarantees for SurrealMX in contrast with the effect on performance.

| Configuration | Survives Process Crash | Survives System Crash | Performance |
|--------------|----------------------|---------------------|-------------|
| No persistence | ❌ | ❌ | Fastest |
| Snapshot-only | ⚠️ (last snapshot) | ⚠️ (last snapshot) | Fastest |
| Async AOL + No fsync | ⚠️ (mostly) | ⚠️ (mostly + OS buffers) | Very fast |
| Async AOL + Interval fsync | ⚠️ (mostly) | ⚠️ (mostly + since last fsync) | Very fast |
| Async AOL + Every fsync | ⚠️ (mostly) | ⚠️ (mostly) | Very fast |
| Sync AOL + No fsync | ✅ | ⚠️ (OS buffers) | Fast |
| Sync AOL + Interval fsync | ✅ | ⚠️ (since last fsync) | Fast |
| Sync AOL + Every fsync | ✅ | ✅ | Slow |

**SurrealDB 2.x**

```bash
surreal start memory
```

SurrealDB will assume `memory` in case this argument is not passed in, so the following command is identical to the above.

```bash
surreal start
```

The default logging level for the database server is `info`. 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.

```bash
surreal start --log debug memory
```

The SurrealDB server runs with authentication by default. In order to disable it, the `--unauthenticated` flag can be passed in.

```bash
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 set to `secret`.

```bash
surreal start --user root --pass secret
```

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`.

```bash
surreal start --user root --pass secret --bind 0.0.0.0:8080 memory
```

After running the above command, you should see the SurrealDB server start up successfully.

```bash
surreal start --user root --pass secret --bind 0.0.0.0:8080 memory
```
```text title="Output"
2025-08-30T15:06:34.788821Z  INFO surrealdb::kvs::ds: Starting kvs store in memory
2025-08-30T15:06:34.788859Z  INFO surrealdb::kvs::ds: Started kvs store in memory
2025-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'.
2025-08-30T15:06:35.205123Z  INFO surrealdb::node: Started node agent
2025-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](/docs/reference/cli/surrealdb-cli/overview.md).
