Mysql binary log file error causes mysql service to fail to start.

Source: Internet
Author: User
Tags mysql command line

Mysql binary log file error causes mysql service to fail to start.

I opened phpmyadmin today and found that I couldn't connect to the mysql database. I couldn't restart mysql and found the following error when I checked the log.

<span style="font-family:SimSun;font-size:12px;">mysqld: File '.\mysql-bin.000370' not found (Errcode: 2)141120 13:23:13 [ERROR] Failed to open log (file '.\mysql-bin.000370', errno 2)141120 13:23:13 [ERROR] Could not open log file141120 13:23:13 [ERROR] Can't init tc log141120 13:23:13 [ERROR] Aborting</span>

Go to the mysql/data directory and manually delete files related to the mysql-bin.xxxxx or go to the mysql command line and execute reset master to delete all logs and restart mysql.

Query That Mysql Data DIRECTORY generated a large number of mysql-bin.xxxxx files is called MySQL Binary Log, mainly has the following two roles:

1. Data Recovery.

2. Improve the reliability of replication on the Master/Slave server.

These logs can be viewed by mysqlbinlog.

# Mysqlbinlog mysql-bin.xxxxx

If you do not need these log files, comment out the following two lines in my. ini and the binary log files will not be generated:
# Log-bin = mysql-bin
# Binlog_format = mixed

If this parameter is not specified, you can configure the number of days for automatic deletion. In the mysql configuration file, find [mysqld] and add the following statement:

Expire_logs_days = 3

You can also directly use the mysql command to configure: mysql> set global expire_logs_days = 1;

You can set the number of days for automatic deletion of binary logs to 3. If this parameter is not set, the default value is 0, indicating that it is not automatically deleted.






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.