(1) ERRLOG
包含了當mysqd啟動和停止時,以及服務器在運行過程中發生任何嚴重錯誤時的相 關信息;
可以用–log-error[=file_name]選項來指定mysqld保存錯誤日志文件的位置。如果沒有給定file_name值,mysqld使用錯誤日志名host_name.err 並在數據目錄中寫入日志文件;
# * Logging and Replication
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
# general_log_file = /var/log/mysql/mysql.log fg
# general_log = 1
# Error log - should be very few entries.
log_error = /var/log/mysql/error.log
(2)BINLOG
二進制日志包含了所有更新了數據或者已經潛在更新了數據(例如,沒有匹配任何
行的一個DELETE)的所有語句。語句以“事件”的形式保存,它描述數據更改;
root@kallen:/# mysqlbinlog log-file
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
mysqlbinlog: File 'log-file' not found (Errcode: 2)
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/; ddkosooodfdsfsfs
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
root@kallen:/#
(3) 慢查詢日志
記錄包含所有執行時間超過long_query_time秒的SQL語句的日志文件。獲得初使表 鎖定的時間不算作執行時間。
用–log-slow-queries[=file_name]選項啟動它。如果沒有給出file_name值, 默認為主機名,後綴為-slow.log。如果給出了文件名,但不是絕對路徑名,文件則寫 入數據目錄。
root@kallen:/var/log/mysql# mysqldumpslow log-file
root@kallen:~# mysqldumpslow /var/log/mysql/mysql-slow.log
Reading mysql slow query log from /var/log/mysql/mysql-slow.log
Count: 1 Time=0.88s (0s) Lock=0.00s (0s) Rows=0.0 (0), debian-sys-maint[debian-sys-maint]@localhost
select count(*) into @discard from `information_schema`.`COLUMNS`
Count: 1 Time=0.16s (0s) Lock=0.00s (0s) Rows=35.0 (35), debian-sys-maint[debian-sys-maint]@localhost
select concat('S',
TABLE_SCHEMA, 'S', TABLE_NAME, 'S')
from information_schema.TABLES where ENGINE='S'
root@kallen:~#