Enable MySQL binlog log

Preface

The binlog log, or binary log, is a binary log file. It has two functions, one is incremental backup, that is, only the new content is backed up; the other is for master-slave replication, etc., that is, the master node maintains a binlog log file, and the slave node synchronizes data from the binlog

 

premise

Install Mysql   https://blog.csdn.net/javanbme/article/details/111825296

 

Opening steps 

1. Log in to Mysql

mysql -h 127.0.0.1  -u root -p

  Enter password to log in 

2. View status

show variables like '%log_bin%';

Not turned on

3. Create directory and set permission group

mkdir /usr/local/mysql/log-bin
chown -R mysql:mysql /usr/local/mysql
chmod -R 755 /usr/local/mysql

4. Modify mysql configuration

vi /etc/my.cnf

  Press i in English input state to enter insert mode, add the following configuration

server-id=1
log-bin=/usr/local/mysql/log-bin/mysql-bin

  Press esc and enter  : wq to  save and exit. The
  server-id represents the id of a single node. Here, since there is only one node, the id can be randomly designated as a number, and the id is set to 1. If there are multiple nodes in the cluster, the id cannot be the same. The
  log-bin name of the log file is mysql-bin and its storage path

5. Restart Mysql

service mysql restart

6. View the binlog log directory 

7. Verify that the opening is successful

Re-enter Mysql to view the status (steps refer to 1, 2) ON is turned on

 

 

 

Guess you like

Origin blog.csdn.net/javanbme/article/details/113058976