Mysql5.7 under Windows to open binlog steps and precautions

1. Check whether binlog is enabled: show binary logs;

   

    It is not enabled by default.

2. Turn on binlog: modify the configuration file my.ini of mysql. Add the following configuration:

   

   The file is not allowed to be modified by default. You need to right-click and "Administrator take ownership" to save the modification.

   Also, note that my.ini in the figure is located at: C:\ProgramData\MySQL\MySQL Server 5.7, not at: C:\Program Files\MySQL\MySQL Server 5.7. Look at the picture:

   

    

3. Restart the mysql service. As shown in the figure:

   

4. Verify that binlog is enabled: show variables like 'log_bin'; and  show binary logs;

   

5. The location of the binlog file: if the full path is given when modifying the binlog of my.ini, the generated log file will be in the specified directory; if only one name is given in step 2, then the generated binlog log will be The location is:

   

    Suppose the given full path configuration is:

    

    After the service is restarted, the mysql-bin.000001 and mysql-bin.index files will be generated in the specified directory:

   

However, it should be noted that the corresponding folder path needs to be created and processed first (such as E:/Mysql-binlog here), otherwise mysql startup will report an error (the non-existing file path will not be created by itself). Eventually , mysql-bin.index and mysql-bin* will be created under E:/Mysql-binlog. The name mysql-bin here is determined by the last level of the defined log-bin ( E:/Mysql-binlog/ mysql-bin ).


Reference: https://www.cnblogs.com/wangwust/p/6433453.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324894637&siteId=291194637