Monday, July 9, 2012

MYSQL SERVER LOGS


Error Log
The error logs contains information that MySQL occur while the server is running, startup and shutdown data. the error log includes the incorrect password as well as the syntax error in the configuration file. The error logs found in the data directory where the mysql folder is placed and called either mysql.err (on Windows) or hostname.err. You can specify a directory to place the logs unless you give the absolute path to create the file.

General Query log
The general query log as the name indicate, the mysqld act as the general information. It logs all the connections and all executed queries. You can see who is logging on from some place as well as to identify what queries is being run and what time and it can be useful to know the information. To enable the query log, log = [querylog_filename]in the my.ini configuration file. It’s not mandatory to indicate a name in the filename, automatically, the query log will be given the hostname.

Binary log
the event which describe database changes such as as table creation operations or changes to table data is the content of binary log. To enable the binary log: log-bin[=binary_update_log_filename]
in your configuration file. The filename is mandatory and like the query log, the log will be named hostname-bin, with hostname being the name of the host. In an efficient binary format, this log stores all updates to the database.

Slow query log
The SQL statements has the slow query log and it took more than long query time seconds to execute and required at least min_examined_row_limit rows to be examined. Only integer times are written for logging to tables. Times are written including the microseconds part for logging to a file. You can enable the slow query logs, set a slow log query log file, and set the log_query_time in my.cnf.
Edit the MySQL configuration file.
vi /etc/my.cnf
In the [mysqld] section add/edit the following variables
long_query_time = 0
slow_query_log = 1
slow_query_log_file=/var/log/mysqld.slow.query.log

No comments:

Post a Comment