MySQL maintains a series of log files that administrators rely on extensively. The primary log files are
The error log contains details about startup and shutdown problems and any critical errors. The log is usually named hostname.err in the data directory. This name can be changed using the --log-error command-line option.
The query log logs all MySQL activity and can be very useful in diagnosing problems. This log file can get very large very quickly, so it should not be used for extended periods of time. The log is usually named hostname.log in the data directory. This name can be changed using the --log command-line option.
The binary log logs all statements that updated (or could have updated) data. The log is usually named hostname-bin in the data directory. This name can be changed using the --log-bin command-line option. Note that this log file was added in MySQL 5; the update log is used in earlier versions of MySQL.
As its name suggests, the slow query log logs any queries that execute slowly. This log can be useful in determining where database optimizations are needed. The log is usually named hostname-slow.log in the data directory. This name can be changed using the --log-slow-queries command-line option.
When logging is being used, the FLUSH LOGS statement can be used to flush and restart all log files.