9.3 配置 Mysql
步骤 1: 赋权限
GRANT ALL PRIVILEGES ON *.* TO canal@'%' IDENTIFIED BY 'canal';
步骤 2: 开启 binlog
打开文件/etc/my.cnf
, 如果没有就创建一个
添加如下配置:
[mysqld]
server-id= 1
log-bin= mysql-bin
binlog_format= row
binlog-do-db= gmall
步骤 3: 重启 mysql 使 binlog 生效
service mysql restart
步骤 4: 检查 binlog 是否生效
进入 mysql
mysql> show variables like 'log_%';
+----------------------------------------+--------------------------------+
| Variable_name | Value |
+----------------------------------------+--------------------------------+
| log_bin | ON |
| log_bin_basename | /var/lib/mysql/mysql-bin |
| log_bin_index | /var/lib/mysql/mysql-bin.index |
| log_bin_trust_function_creators | OFF |
| log_bin_use_v1_row_events | OFF |
| log_error | /var/lib/mysql/hadoop201.err |
| log_output | FILE |
| log_queries_not_using_indexes | OFF |
| log_slave_updates | OFF |
| log_slow_admin_statements | OFF |
| log_slow_slave_statements | OFF |
| log_throttle_queries_not_using_indexes | 0 |
| log_warnings | 1 |
+----------------------------------------+--------------------------------+