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

# CDC - MariaDB Setup Documentation

> How to setup CDC MariaDB

## Prerequisites

To set up CDC between your MariaDB database and Peaka BI Table, you need:

* A MariaDB server of any version (most recently tested on version 11.4.3)
* Access to the MariaDB configuration file.

## Setup Instructions

### Setting up permissions

Peaka CDC requires a MariaDB user account. This user must have appropriate permissions on all databases where you want to set up cache through CDC.

1. Create the MariaDB user:

```sql theme={null}
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
```

2. Grant the required permissions to the user:

```sql theme={null}
GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'user' IDENTIFIED BY 'password';
```

3. Finalize the user’s permissions:

```sql theme={null}
FLUSH PRIVILEGES;
```

### Enabling the binlog

1. Check whether the log-bin option is already on:

```sql theme={null}
SHOW VARIABLES LIKE '%log_bin%';
```

2. If the binlog is **OFF**, add the properties in the following table to the configuration file for the MariaDB server:

```sql theme={null}
server-id         = 223344 # Querying variable is called server_id, e.g. SELECT variable_value FROM information_schema.global_variables WHERE variable_name='server_id';
log_bin                     = mariadb-bin
binlog_format               = ROW
binlog_row_image            = FULL
binlog_expire_logs_seconds  = 864000
```

### Validating binlog row value options

Verify the setting of the **binlog\_row\_value\_options** variable in the database. To enable the connector to consume  **UPDATE** events, this variable must be set to a value other than **PARTIAL\_JSON**.

1. Check current variable value

```sql theme={null}
SHOW GLOBAL VARIABLES WHERE variable_name = 'binlog_row_value_options';
```

**Result**

| Variable\_name              | Value |
| --------------------------- | ----- |
| binlog\_row\_value\_options |       |

2. If the value of the variable is set to **PARTIAL\_JSON**, run the following command to unset it:

```sql theme={null}
SET @@global.binlog_row_value_options="" ;
```
