MySQL Log configuration under Windows

Source: Internet
Author: User

Overview of log file types:
1.
Error logging issues that occur when you start, run, or stop mysqld.
My.ini configuration information:
#Enter a name for the error log file. Otherwise a default name would be used.
#log-error=d:/mysql_log_err.txt
2.
Query logging establishes client connections and statements that are executed.
My.ini configuration information:
#Enter a name for the query log file. Otherwise a default name would be used.
#log =d:/mysql_log.txt
3.
The update log records the statement that changes the data. The use of the log is not supported.
My.ini configuration information:
#Enter a name for the update log file. Otherwise a default name would be used.
#log-update=d:/mysql_log_update.txt
4.
The binary log records all statements that change data. Also used for replication.
My.ini configuration information:
#Enter a name for the binary log. Otherwise a default name would be used.
#log-bin=d:/mysql_log_bin
5.
Slow logging all queries that have performed longer than long_query_time seconds or queries that do not use indexes.
My.ini configuration information:
#Enter a name for the slow query log file. Otherwise a default name would be used.
#long_query_time =1
#log-slow-queries= D:/mysql_log_slow.txt

MySQL Log off and on:
Use the following command to see if the log is enabled
Mysql> Show variables like ' log_% '; +---------------------------------+----------------------------------------- ----------------+| Variable_name                   | Value            |+---------------------------------+--------------------------------- ------------------------+| Log_bin                         | OFF            | | log_bin_trust_function_creators | OFF            | | Log_error                       | C:\Program files\mysql\mysql Server 5.0\data\xxq-pc.err | | Log_queries_not_using_indexes   | OFF            | | Log_slave_updates               | OFF            | | Log_slow_queries               &NBsp;| OFF            | | Log_warnings                    | 1            |+---------------------------------+------------------------------------- --------where value is off, the service is not turned on, to enable only the My.ini configuration information to be written (My.ini to the MySQL installation directory), and then remove the previous "#" number, Restart the MySQL service. Conversely, to stop the MySQL log service, simply remove the corresponding configuration information from the My.ini as binary log: From the overview I can see that the log-bin of the My.ini configuration information does not specify a file name extension, because even if you specify the extension it is not used. When MySQL creates a binary log file, it first creates a file with a name of "Mysql_log_bin" and a suffix of ". Index", and then creates a file with "Mysql_log_bin" as the name, with ". 000001" as the suffix. When the MySQL service restarts a file with a ". 000001" suffix, the suffix name is incremented by 1, and a new log file is created if the log length exceeds the upper limit of max_binlog_size (by default, 1G) ; use flushlogs (mysql command) or execute mysqladmin 
–u–p flush-logs (Windows command Prompt) also creates a new log file. Since the write is binary data, open the file with Notepad is not see the normal data, then how to view it? Use the Mysqlbinlog command in the Bin directory, such as: Bin>mysqlbinlog D:/mysql_log/mysql_bin.000001bin>mysqlbinlog d:/mysql_log/mysql_ Bin.000002bin>mysqlbinlog D:/mysql_log/mysql_bin.000003bin>mysqlbinlog D:/mysql_log/mysql_bin.000004Bin >mysqlbinlog d:/mysql_log/mysql_bin.000005 Use SQL statements to view the binary file directories created by MySQL: mysql>showmasterlogs; As for the accurate reading of the log file, Also need readers to read carefully, deep experience, here is no longer an Austrian! (This article is reproduced in http://blog.sina.com.cn/s/blog_4b93170a0100le9y.html), has the reference value.

This article is from the "Rosy Clouds Fly" blog, please be sure to keep this source http://caixia.blog.51cto.com/2266345/1674951

MySQL Log configuration under Windows

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.