Setup Guide
This guide walks you through setting up a MySQL database and obtaining the connection credentials required to use the MySQL connector.
Prerequisites
- A running MySQL server. You can install MySQL locally, use Docker (
docker run --name mysql -e MYSQL_ROOT_PASSWORD=root -p 3306:3306 -d mysql:8), or use a managed service such as AWS RDS, Google Cloud SQL, or Azure Database for MySQL. - A database user with appropriate privileges for the operations you intend to perform.
- For CDC: MySQL binary logging must be enabled with
ROWformat (see the CDC setup step below).
Create a MySQL database and user
-
Connect to your MySQL server using the
mysqlcommand-line client or a GUI tool such as MySQL Workbench. -
Create a new database for your application:
CREATE DATABASE IF NOT EXISTS mydb; -
(Optional) Create a dedicated user and grant privileges:
CREATE USER 'baluser'@'%' IDENTIFIED BY 'balpass';
GRANT ALL PRIVILEGES ON mydb.* TO 'baluser'@'%';
FLUSH PRIVILEGES;
For production environments, follow the principle of least privilege: grant only the specific permissions your application requires (for example, SELECT, INSERT, UPDATE, DELETE).
Note your connection details
Record the following information. You will need it to configure the MySQL client:
- Hostname: The address of your MySQL server (for example,
localhostor a cloud endpoint). - Port: The MySQL port (default
3306). - Username: The database user (for example,
baluser). - Password: The database user's password.
- Database name: The target database (for example,
mydb).
Enable binary logging for CDC (optional)
If you plan to use the Change Data Capture (CDC) listener, you must enable MySQL binary logging in ROW format.
-
Open the MySQL configuration file (
my.cnformy.ini) and add:[mysqld]
log-bin=mysql-bin
binlog-format=ROW
server-id=1 -
Restart the MySQL server:
sudo service mysql restart -
Verify binary logging is enabled:
SHOW VARIABLES LIKE 'log_bin';The value should be
ON.
Binary logging is required for CDC. Without it, the mysql:CdcListener will not receive any change events.
Next steps
- Action Reference: operations, parameters, return types, and sample code.
- Trigger Reference: listener configuration and service callbacks for CDC.