Enable binlogs for the MySQL database

2023-11-30 06:45:08  Updated

When OceanBase Migration Service (OMS) Community Edition is performing full data migration tasks, it reads the binlogs of the source MySQL database to synchronize incremental data to the destination database in real time. Before migrating incremental data from a MySQL database by using OMS Community Edition, you must enable binlogs for the MySQL database.

The binlog configuration of the MySQL database is checked in the precheck step of a data migration task. If an error occurs during the precheck, enable binlogs for the MySQL database by performing the following operations.

Procedure

  1. Log on to the host where the self-managed MySQL database resides.

  2. Run the following command to modify the my.cnf file of the MySQL database.

    The my.cnf file is stored at /etc/my.cnf by default.

    log_bin=mysql_bin
    binlog_format=row
    binlog_row_image=full // This setting is required if the source database version is MySQL 5.6 or later.
    
  3. Run the following command to restart the MySQL database.

    [$Mysql_Dir] must be replaced with the installation path of the MySQL database.

    [$Mysql_Dir]/bin/mysqladmin -u root -p ******
    [$Mysql_Dir]/bin/safe_mysqld &
    
  4. Log on to the self-managed MySQL database and execute the following SQL statement to confirm that the binlog feature is enabled.

    show variables like '%log_bin%';
    

    In the returned information, both log bin and sql log bin must be ON to indicate that the binlog feature is enabled.

Contact Us