Open the windows binlog

  Part I we introduced the binlog (see binlog mysql's ), using a configuration file my.cnf under linux, then how to open under windows binlog it? The truth is the same, the configuration file is not the same. In the windows we need to configure my.ini, with the same name but a different extension. Let's look at my local mysql binlog the switch is turned on:

mysql> show variables like '%log_bin%';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| log_bin                         | OFF   |
| log_bin_basename                |       |
| log_bin_index                   |       |
| log_bin_trust_function_creators | OFF   |
| log_bin_use_v1_row_events       | OFF   |
| sql_log_bin                     | ON    |
+---------------------------------+-------+
6 rows in set, 1 warning (0.00 sec)

  It is clear and is not open, then we need to find my.ini, then binlog switch configurations. My local mysql is downloaded from the official website after the 5.7 version resulting archive decompression, looking for a long time and did not find my.ini. This is because the compression bag mysql version 5.7 does not my.ini configuration file. We can only own hands to create a my.ini, and the binlog switch configurations to be put in:

 

[ Mysql ] 
# Set the mysql client default character set 
default - Character - the SET = utf8 
 [ mysqld ] 
# set port 3306 
Port =  3306  
# Set the mysql installation directory 
basedir = D: \ Dev \ mysql \ mysql - 5.7 . 26 - Winx64 
the maximum number of connections allowed # 
max_connections = 200 is 
# character set used by the server defaults to the 8-bit coded character set latin1 
character - sET - Server = UTF8 
# default storage engine to be used when creating a new table 
default - storage -Engine = INNODB 
# open the binlog 
log_bin = mysql - the binlog 
. Id # Server database server id, and this flag is used in the main server from the server in single mysql 
Server - id = . 1

  Marked yellow is my local mysql installation directory, the file my.ini also put here. The last one is mysql5.7 need to add to the version used to identify the mysql server ID, without being given the boot. When the file is created with the administrator running the Windows command line, restart mysql:

C: \ WINDOWS \ system32> NET STOP MySQL 
MySQL service is stopping .. 
MySQL service was stopped successfully. 

C: \ WINDOWS \ system32 > NET Start MySQL 
MySQL service is starting. 
MySQL service has started successfully.

  Then look at the switch binlog:

mysql> show variables like '%log_bin%';
+---------------------------------+----------------------------------------------------------+
| Variable_name                   | Value                                                    |
+---------------------------------+----------------------------------------------------------+
| log_bin                         | ON                                                       |
| log_bin_basename                | D:\Dev\mysql\mysql-5.7.26-winx64\data\mysql-binlog       |
| log_bin_index                   | D:\Dev\mysql\mysql-5.7.26-winx64\data\mysql-binlog.index |
| log_bin_trust_function_creators | OFF                                                      |
| log_bin_use_v1_row_events       | OFF                                                      |
| sql_log_bin                     | ON                                                       |
+---------------------------------+----------------------------------------------------------+
6 rows in set, 1 warning (0.00 sec)

  The binlog open.

Guess you like

Origin www.cnblogs.com/wuxun1997/p/11110608.html