In MYSQL server, there are many logs available which
helps find out what activity is taking place. Those are the error log, general
query log, binary log and the slow query log. Today we will discuss the
importance and the function of these logs.
ERROR LOG
The error log enables us to know the problems that are encountered while starting, running or stopping the server of simply the mysqld.exe. It contains the when was mysqld started and when was it stopped. It also contains critical errors that occurred while the server was running. It also writes a message to the error log if mysqld notice that a table needed to be automatically checked or repaired. The error log is important because using the error log you can determine where or what operation did the mysqld died.
The error log enables us to know the problems that are encountered while starting, running or stopping the server of simply the mysqld.exe. It contains the when was mysqld started and when was it stopped. It also contains critical errors that occurred while the server was running. It also writes a message to the error log if mysqld notice that a table needed to be automatically checked or repaired. The error log is important because using the error log you can determine where or what operation did the mysqld died.
The default name of error log is 'host_name'.err. To
change the name of the error log file you can go to your my.ini file in windows
and write at the bottom log-error='name you like'.log or if you want you can
use .err instead of .log to show that it is an error log.
The general query log shows us the established client connections and statements received from the clients. It is the general record of the activities done by mysqld. When the client connects and disconnects the server writes its log in the general query log. It also records the SQL statements received from the clients. It is important because it can be used to determine what the client sent to mysqld so you would know what caused an error. It makes you aware what the mysqld received from a client which can be used to determine the causes of an error.
If you want to change the name of the general query log file you can go to your my.ini file in windows and write at the bottom log='name you like'.log and save it.
If you want to change the name of the general query log file you can go to your my.ini file in windows and write at the bottom log='name you like'.log and save it.
The binary log shows us the statements that may have
changed the data. It also contains events that describe the changes in the
database like creation of a table or changes to the table data. It also shows information
about how long each statement took that updated the data.
The binary log is important because of its two purposes. The first one is it can be used for replication. The binary log is used on master replication servers as a record of the statements to be sent to slave servers. The master server sends the events contained in its binary log to its slaves, which execute those events to make the same data changes that were made on the master.
The binary log is important because of its two purposes. The first one is it can be used for replication. The binary log is used on master replication servers as a record of the statements to be sent to slave servers. The master server sends the events contained in its binary log to its slaves, which execute those events to make the same data changes that were made on the master.
Its second purpose is
to keep the database up to date from the point of the backup after it is
restored using a backup. After a backup has been restored, the events in the
binary log that were recorded after the backup was made are re-executed.
If you want to change the name of the binary log file you
can go to your my.ini file in windows and write at the bottom log-bin='name
you like' and save it.
The slow query log shows us the queries that took more
than the long query time seconds to execute. The minimum value of long query time is 1 and its default
value is 10. Slow queries are important because
it can be used to find queries that take long time to execute. Those queries
that take long time to execute can become subject for optimization.
If you want to change the name of the slow query log file
you can go to your my.ini file in windows and write at the bottom log-slow-query='name
you like'.log and save it.
These logs are created to provide information about the
server options that enable logging in each specific log section. By default
these logs are disabled. You can use the my.ini to control these logs and
assign the name you want to use. Hope
you like the discussion.
Source: mysql.com
No comments:
Post a Comment