MySQL binlog opening steps

MySQL binlog opening steps

Binlog is a binary log file that is used to record MySQL data changes. Binlog logs can play a big role when restoring data. MySQL master-slave replication uses the binlog principle

1. After logging in to MySQL, use the following command to check whether binlog is enabled

show variables like 'log_%';

2. Edit the configuration file

vi /etc/my.cnf

3. Add the following content

server_id=2

log_bin = mysql-bin

binlog_format = ROW

expire_logs_days = 30

4. Restart MySQL service

systemctl restart mysqld

5. Use the command show variables like 'log_%' again to view it. If it is ON, it means binlog is turned on.

6. The binlog log file storage path is

/var/lib/mysql

7. Files like mysql-bin.000001 mysql-bin.000002 will be generated in this path

You may also be interested in:
  • [MySQL binlog] How to thoroughly parse binlog in Mixed log format in MySQL
  • Introduction and analysis of three Binlog formats in MySQL
  • Two ways to correctly clean up mysql binlog logs
  • Binlog related commands and recovery techniques in MySQL
  • Summary of Binlog usage of MySQL database (must read)
  • Detailed explanation of Mysql Binlog data viewing method
  • MySQL's processing of binlog
  • Detailed explanation of MySQL database binlog cleanup command
  • How to choose the format when using binlog in MySQL

<<:  How to develop Java 8 Spring Boot applications in Docker

>>:  20 JavaScript tips to help you improve development efficiency

Recommend

Detailed explanation of the difference between run/cmd/entrypoint in docker

In Dockerfile, run, cmd, and entrypoint can all b...

Analysis and solution of the problem that MySQL instance cannot be started

Table of contents Preface Scenario Analysis Summa...

How to install a virtual machine with Windows services on Mac

1. Download the virtual machine Official download...

Solution to PHP not being able to be parsed after nginx installation is complete

Table of contents Method 1 Method 2 After install...

Implementation of Redis master-slave cluster based on Docker

Table of contents 1. Pull the Redis image 2. Crea...

HTML web page image tag

Insert image tag <IMG> The colorful web page...

Use docker to deploy tomcat and connect to skywalking

Table of contents 1. Overview 2. Use docker to de...

Specific use of nginx keepalive

The default request header of the http1.1 protoco...

Win10 + Ubuntu 16.04 dual system perfect installation tutorial [detailed]

Be sure to remember to back up your data, it is p...

Summary of webpack's mobile adaptation solution

Table of contents rem vw Adapt to third-party UI ...

JavaScript lazy loading detailed explanation

Table of contents Lazy Loading CSS styles: HTML p...

MySQL sorting using index scan

Table of contents Install sakila Index Scan Sort ...

How to modify server uuid in Mysql

Source of the problem: If the slave server is the...

Write a mysql data backup script using shell

Ideas It's actually very simple Write a shell...