Postgres

Configuring your Postgres database with PowerSync generally involves three tasks:

  • Enable logical replication
  • Create a PowerSync database user
  • Create powersync publication

We have documented steps for some hosting providers:

For other providers and self-hosted databases:

Unsupported Hosted Postgres Providers

Due to the logical replication requirement, not all hosting providers are supported.

Notably, some “serverless Postgres” providers do not support logical replication, and are therefore not supported by PowerSync yet.

MongoDB (Alpha)

This section is a work in progress. More details for MongoDB connections are coming soon. In the meantime, check our MongoDB guide to try out our MongoDB alpha support, and ask on our Discord server if you have any questions.

PowerSync requires the find and changeStream permissions on all databases and collections.

PowerSync also requires createCollection, insert, update, and remove permissions to the _powersync_checkpoints collection.

For MongoDB Atlas users, PowerSync requires readWrite@mydb._powersync_checkpoints and readAnyDatabase@admin

MySQL (Alpha)

This section is a work in progress. More details for MySQL connections are coming soon. In the meantime, ask on our Discord server if you have any questions.

MySQL connections use the binary log to replicate changes.

Generally, this requires the following config:

  • gtid_mode : ON
  • enforce_gtid_consistency : ON
  • binlog_format : ROW

PowerSync also requires a user with replication permissions on the database. An example:

-- Create a user with necessary privileges
CREATE USER 'repl_user'@'%' IDENTIFIED BY 'good_password';

-- Grant replication client privilege
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repl_user'@'%';

-- Grant access to the specific database
GRANT ALL PRIVILEGES ON powersync.* TO 'repl_user'@'%';

-- Apply changes
FLUSH PRIVILEGES;

Next Step

Next, connect PowerSync to your database:

Database Connection

Self-hosting: If you are self-hosting PowerSync, refer to PowerSync Service Setup next.