MySQL 8 Installation & Debezium/Kafka Connect User Setup on CentOS 8
MySQL 8 Installation & Debezium/Kafka Connect User Setup on CentOS 8
📘 MySQL 8 Installation & Debezium/Kafka Connect User Setup on CentOS 8
This guide explains how to:
- Install MySQL 8 on CentOS 8
- Secure the MySQL installation
- Enable remote access
- Create a user for Debezium/Kafka Connect
- Configure the user to use mysql_native_password
- Enable MySQL binlog for CDC (Change Data Capture)
✅ Prerequisites
You need:
- A CentOS 8 server
- A non-root user with sudo privileges
- firewalld enabled
🟦 Step 1 — Install MySQL 8
CentOS 8 ships with MySQL 8 in its official repositories.
Install MySQL:
sudo dnf install mysql-server
Start MySQL:
sudo systemctl start mysqld
Check service:
sudo systemctl status mysqld
Enable MySQL on boot:
sudo systemctl enable mysqld
🟦 Step 2 — Secure MySQL Installation
Run the MySQL secure installation script:
sudo mysql_secure_installation
This script allows you to:
- Set root password
- Remove anonymous users
- Disable root remote login
- Remove test DB
- Reload privilege tables
Follow the prompts accordingly.
🟦 Step 3 — Configure MySQL for Debezium (Binary Log Settings)
Debezium requires MySQL binary logs (binlog).
Edit MySQL config:
sudo nano /etc/my.conf.d/mysql-server.cnf
Add or update:
[mysqld]
server-id=1
log_bin=mysql-bin
binlog_format=ROW
binlog_row_image=FULL
expire_logs_days=7
Restart MySQL:
sudo systemctl restart mysqld
Verify:
mysql -u root -p -e "SHOW VARIABLES LIKE 'log_bin';"
mysql -u root -p -e 'SHOW VARIABLES LIKE "binlog_format";'
Expected:
log_bin = ONbinlog_format = ROW
🟦 Step 4 — Login to MySQL
mysql -u root -p
🟦 Step 5 — Create Kafka Connect / Debezium User
Debezium requires specific permissions.
Create user with mysql_native_password:
CREATE USER 'kafkaconnector'@'%'
IDENTIFIED WITH mysql_native_password
BY 'StrongPassword123!';
Grant privileges:
GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT
ON *.* TO 'kafkaconnector'@'%';
Apply privileges:
FLUSH PRIVILEGES;
🟦 Step 6 — Allow Remote MySQL Connections (Optional)
Edit MySQL bind address:
sudo nano /etc/my.conf.d/mysql-server.cnf
Set:
bind-address = 0.0.0.0
Restart:
sudo systemctl restart mysqld
Allow MySQL through firewall:
sudo firewall-cmd --add-port=3306/tcp --permanent
sudo firewall-cmd --reload
🟦 Step 7 — Verify the Kafka/Debezium User
Inside MySQL:
SELECT user, host, plugin FROM mysql.user;
You should see:
kafkaconnector | % | mysql_native_password
Test remote login:
mysql -u kafkaconnector -p -h <MYSQL-IP>
🎉 MySQL is Ready for Kafka Connect & Debezium
You now have:
- A working MySQL 8 server
- Secured installation
- Enabled binlog for CDC
- A Debezium/Kafka-ready user
- Compatible mysql_native_password authentication
Next step: configure the Debezium MySQL connector in Kafka.