Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Tuesday, October 9, 2012

Managing MySQL Server Logs

Managing MySQL Server Logs
MySQL Server provides several logs that help us find out what activity is taking place. MySQL provides different types of log files. 
Error Log: contains information indicating when mysqld was started and stopped and also any critical errors that occur while the server is running. 
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. 
Binary Log: contains “events” that describe database changes such as table creation operations or changes to table data. 

Relay Log: consists of the events read from the binary log of the master and written by the slave I/O thread. Slow Query Log: consists of SQL statements that took more than long_query_time seconds to execute.

MySQL server log management can be divided into 3 major steps:
  1. Checking
  2. Setting
  3. Restart
Checking: By default, no logs are enabled. Administrator has to enable the server logging.
    mysql> show variables like '%log%';
Managing MySQL Server Logs


Setting: To set the MySQL variables, use the SET keyword or make change in my.ini (mysql configuration) file.
    mysql> SET GLOBAL log = 'ON'; 

Managing MySQL Server Logs

Restart: To reflect the changes, mysql services need to be restarted and enjoying logging on servers using MySQL.
Managing MySQL Server Logs
    shell$ service mysqld restart 

No comments:

Post a Comment