Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I want to know what logging options are available to me in MySQL; I find a lot more results about binary logging than I do about general/error logging and I'm not sure what options are available to me for such logs.

Could anyone tell me a list of the my.cnf variables I can set to get different types of logs?

Cheers!

Chris

share|improve this question

2 Answers 2

Well, each log is for a different purpose.

  1. Binary logs - Required for acting as a replication master and useful for auditing or point in time restores from backups
  2. Relay logs - Required for acting as a replication slave. They are only stored until applied to the slave and then removed automatically
  3. General query log - All the queries executed by the server
  4. Slow query log - Queries that are 'slow'. Based on executing time and/or index usage
  5. Innodb logs - These are internal to the innodb engine and not a classic log for you to look at. It stores the data post the current checkpoint and so it can be merged into sequential writes rather then random writes all over the table.
  6. Error logs - Just stderr from the mysqld process

What are you after? Queries run or slow queries or?

share|improve this answer

There are basically four types of logs

1) The Error Log

The error log contains information indicating when mysqld was started and stopped and also any critical errors that occur while the server is running.

2) General Query Log

The general query log is a general record of what mysqld is doing. The server writes information to this log when clients connect or disconnect, and it logs each SQL statement received from clients.

3) Binary Log

The binary log contains “events” that describe database changes such as table creation operations or changes to table data. It also contains events for statements that potentially could have made changes

4) Slow Query Log

The slow query log consists of SQL statements that took more than long_query_time seconds to execute. The minimum and default values of long_query_time are 1 and 10, respectively.

All other files you can read easily but to read Binary log you have to use a MySQL utility program called mysqlbinlog

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.