MySQL Database cleanup System log (cleanup for master-slave replication primary server)

Source: Internet
Author: User
Tags system log

1. What are the MySQL log files on the master server?

View by command:

Show binary logs;

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/85/45/wKioL1ee4Bqi9Zz0AAAwuxXkZk0315.png-wh_500x0-wm_3 -wmp_4-s_6781112.png "title=" 1.png "alt=" Wkiol1ee4bqi9zz0aaawuxxkzk0315.png-wh_50 "/>

2. View the binary logs used by the synchronization from the server.

With the command:show slave status\g

, mysql-tb-bin.000005 This log file is in use.

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/85/44/wKiom1ee4NCCcrr3AADg6mDs6mk384.png-wh_500x0-wm_3 -wmp_4-s_158250329.png "style=" Float:none; "title=" 2.png "alt=" Wkiom1ee4ncccrr3aadg6mds6mk384.png-wh_50 "/>


3, back to the primary server, start to clean up the log, but can not clean up the mysql-tb-bin.000005 log file,

With command:purge binary logs to ' mysql-tb-bin.000005 ';

This command is to clean up the binary logs except mysql-tb-bin.000005;

After successful execution, view the binary log list: show binary logs;

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M01/85/44/wKiom1ee4NDg2bXWAAAafy-UiIY311.png-wh_500x0-wm_3 -wmp_4-s_1662411719.png "style=" Float:none; "title=" 3.png "alt=" Wkiom1ee4ndg2bxwaaaafy-uiiy311.png-wh_50 "/>

Cleanup succeeds, but the manual cleanup is dangerous and manual cleanup is done manually.

Can be added in My.ini:

Expire_logs_days=5

The purpose of this configuration is that MySQL will automatically clean up logs that expire for 5 days


This article is from the "Wang Liming" blog, make sure to keep this source http://80cto.blog.51cto.com/7503144/1832996

MySQL Database cleanup System log (cleanup for master-slave replication primary server)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.