mysql SLOW QUERY logging 하기
2010. 1. 7. 20:42ㆍ99. 정리전 - IT/15. SQL 따라잡기
------------------------------------------------------
You must create the file manually and change owners this way:
# mkdir /var/log/mysql
# touch /var/log/mysql/log-slow-queries.log
# chown mysql.mysql -R /var/log/mysql
------------------------------------------------------
/etc/my.cnf 에서
[mysqld]
set-variable=long_query_time=10
log-slow-queries=/var/log/mysql/log-slow-queries.log
# /usr/local/mysql/bin/mysqld_safe --log-slow-queries=/var/log/mysql/slow_query.log -O long_query_time=5
참고
http://docs.google.com/viewer?a=v&q=cache:3hC0pjI4bdAJ:data.oss.or.kr/sw/download.php%3Fnum%3D923%26file%3D20070604_TD_%25B1%25E2%25BC%25FA%25B9%25AE%25BC%25AD_MYSQL%25C6%25A9%25B4%25D7%25B1%25E2%25BC%25FAmysqld_safe4%25C6%25ED.pdf+mysqld_safe+--log-slow-queries%3D/var/log/mysql/slow_query.log+-O+long_query_time%3D&hl=ko&pid=bl&srcid=ADGEEShOKTirAj8uV9F3qL93Wz7hO_ivfMHMJ-05oamZvwEe8cPMGn-I6eYjjX9b1k2kxx-rK5Dfi1A5sgGPfhNb3W5YxemAdpiYTdP_xgKLshvMU3lWUtnRaTFogfKv7erqTFcgWQFx&sig=AHIEtbTHvsqTpFMeYYmb033OZnFt719Fxg
You must create the file manually and change owners this way:
# mkdir /var/log/mysql
# touch /var/log/mysql/log-slow-queries.log
# chown mysql.mysql -R /var/log/mysql
------------------------------------------------------
/etc/my.cnf 에서
[mysqld]
set-variable=long_query_time=10
log-slow-queries=/var/log/mysql/log-slow-queries.log
# /usr/local/mysql/bin/mysqld_safe --log-slow-queries=/var/log/mysql/slow_query.log -O long_query_time=5
참고
http://docs.google.com/viewer?a=v&q=cache:3hC0pjI4bdAJ:data.oss.or.kr/sw/download.php%3Fnum%3D923%26file%3D20070604_TD_%25B1%25E2%25BC%25FA%25B9%25AE%25BC%25AD_MYSQL%25C6%25A9%25B4%25D7%25B1%25E2%25BC%25FAmysqld_safe4%25C6%25ED.pdf+mysqld_safe+--log-slow-queries%3D/var/log/mysql/slow_query.log+-O+long_query_time%3D&hl=ko&pid=bl&srcid=ADGEEShOKTirAj8uV9F3qL93Wz7hO_ivfMHMJ-05oamZvwEe8cPMGn-I6eYjjX9b1k2kxx-rK5Dfi1A5sgGPfhNb3W5YxemAdpiYTdP_xgKLshvMU3lWUtnRaTFogfKv7erqTFcgWQFx&sig=AHIEtbTHvsqTpFMeYYmb033OZnFt719Fxg