Enable and view MySQL binary files [windows]

Source: Internet
Author: User
Tags mysql commands

Today, I am so frustrated that I cannot install a virtual machine on windows. I was trying to install a MySQL test on Linux. Now I can only install MySQL on Windows, after four or five times of installation, I wiped my sweat. Come to the super basic cainiao thing-view the binary file...

About the something of the MySQL binary file:

MySQL binary log:

From the overview, I can see that the log-bin of my. ini configuration information does not specify the file extension, because it is not used even if you specify the extension. When MySQL creates a binary log file, it first creates a file named "mysql_log_bin" and named ". index, and create a file named "mysql_log_bin" with the suffix ". 000001. When the MySQL service is restarted once, A file with a suffix of 000001 is added, and the suffix name is incremented by 1. If the log length exceeds the upper limit of max_binlog_size (1 GB by default), a new log file is created; A new log file is also created when you run the flush logs command or mysqladmin-u-p flush-logs command prompt.

Since MySQL binary data is written, normal data cannot be seen when you open a file in Notepad. How can we view it?

(The Orange text is for reference)

Step 1: Set the binary log file.

By default, MySQL does not enable those logs, such as binary logs, error logs, slow logs, and query logs...

Regression question: Enable binary logs...

In the my. ini file [mysqld], add:

# Custom define
Log-bin = mysql-bin

Long_query_time = 0.1.
Log-Slow-queries = "C:/Documents and Settings/all users/Application Data/MySQL Server 5.1/data/slow. log"
Log-queries-not-using-indexes = true

Log-error = "C:/Documents and Settings/all users/Application Data/MySQL Server 5.1/data/log-error.log"
Note: Binary logs, slow logs, and error logs are enabled in sequence.

Step 2: restart the MySQL Service

CMD MediumNet stop MySQL

Net start MySQL

(In Windows, unlike in Linux, there is a restart... sorry ...)

Step 3: view the directory where binary log files are stored. (For example, see the picture)

Show variables like 'datadir ';

Show Master status;

Step 4: Use mysqlbinlog to view binary log files. (For example, see the picture)

Complete path of mysqlbinlog binary log file

For example:Mysqlbinlog c: \ Documents ents and Settings \ All Users \ Application Data \ mysql \ MySQL Server 5.1 \ data \ mysql-bin.000002

Figure:

In Windows, you can enter MySQL directly through the client, or enter the bin in the directory where MySQL is installed in cmd to call up MySQL commands. The MySQL version and other information are displayed.

Step 3 & 4:

Make up the logs related to the basic things... To be continued... today, I got the medal from a deep blogger. I want to cheer up ~ Mission!

 

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.