> ## Documentation Index
> Fetch the complete documentation index at: https://docs.risingwave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up Neon PostgreSQL

> How to set up a serverless Neon PostgreSQL database as a source for RisingWave.

To connect RisingWave to a [Neon](https://neon.tech/) database for Change Data Capture (CDC), you first need to configure your Neon project.

## 1. Create a Neon project

If you haven't already, sign up for a Neon account and create a project. This will provision a new serverless PostgreSQL database. Note your project's connection details.

## 2. Enable logical replication

Connect to your Neon database using the provided SQL Editor or any compatible `psql` client.

Run the following command to set the `wal_level` to `logical`, which is required for CDC.

```sql theme={null}
ALTER SYSTEM SET wal_level = logical;
```

Your Neon project may need to restart for this change to apply.

## 3. Configure a replication user

Create or alter a user, granting them the necessary roles for replication.

```sql theme={null}
-- Create a new user with a secure password
CREATE USER <user_name> WITH REPLICATION LOGIN PASSWORD '<your_password>';

-- Or, assign attributes to an existing user
ALTER USER <user_name> WITH REPLICATION LOGIN;
```

You can verify the roles by running `\du` in `psql`.

## 4. Grant required privileges

Finally, grant the user the necessary privileges on the database and schemas you want to capture changes from.

```sql theme={null}
-- Grant connection access to the database
GRANT CONNECT ON DATABASE <database_name> TO <user_name>;

-- Grant usage on the schema
GRANT USAGE ON SCHEMA <schema_name> TO <user_name>;

-- Grant select on all tables in the schema
GRANT SELECT ON ALL TABLES IN SCHEMA <schema_name> TO <user_name>;
```

## Next step

Now that your Neon database is configured, you can proceed to connect RisingWave.

➡️ **[Connect to PostgreSQL CDC](/ingestion/sources/postgresql/pg-cdc)**
