Today, I read the previous part of MySQL performance tuning and architecture design. I saw the log file and actually did a test. Here I will summarize it.
I am using MySQL under windows, and there is a lot of content in MySQL under Linux on the Internet. Here the right should be a little bit supplemented.
MySQL has the following types of log files:
- Error Log: records errors during database startup, operation, and stop;
- Binary log: records all statements for modifying database data;
- Update log: records the statement for changing data. It is not recommended to use it. It is replaced by binary logs;
- Query log: records the client connection and executed SQL statements;
- Slow query log: records all statements whose execution time exceeds the maximum SQL Execution time (long_query_time) or whose indexes are not used;
- InnoDB's online redo log: InnoDB is a transaction-safe storage engine. Its transaction security is mainly guaranteed by the online redo log and the Undo information recorded in the tablespace.
The configuration items corresponding to the preceding log file are shown in the following table:
Error Log |
-- Log-error = [filename] |
Binary log |
-- Log-bin [= file_name] |
Update log |
This log is no longer supported in version 5.0 or later |
Query logs |
-- Log [= fina_name] |
Slow query log |
-- Log-Slow-queries [= file_name] |
InnoDB online redo logs |
It can only change its storage location |
|
|
We can configure these log files using two paths. Here we take the configuration of querying logs and binary logs as an example.
1. Configure in my. ini file, that is, add the following content at the end of my. ini file:
Log-error = c: \ err. loglog = c: \ log. Log
Then restart the MySQL service to view the log files in drive C. Use this method to view other log files.
2. specify when starting the MySQL service: First stop MySQL, and then jump to the MySQL installation directory. For example, you can see the full name MEW under drive C. log query log files. If you need to enable other logs, add the mysqld file. For example:
Mysqld -- log = "C: \ new. log" -- log-error = "C: \ error. log"
Yes, this log enabling method is complete.