Doing MySQL query profiling for a website
I'm trying to setup mysql query profiling as highlighted in http://dev.mysql.com/doc/refman/5.1/en/log-destinations.html
In
/etc/my.cnf
I added:
general_log=1
log_output=FILE
log=/tmp/mysql.log
i did
/etc/init.d/mysqld restart
Stopping MySQL开发者_JAVA百科: [ OK ]
Starting MySQL: [ OK ]
My mysql version is:
Server version: 5.0.77 Source distribution
But it did not work! No /tmp/mysql.log
The problem you have is that log_output
was introduced in 5.1.
Take a look: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_log_output
Version Introduced 5.1.6
Also, in the article you pointed it says:
SET GLOBAL log_output='TABLE'; SET GLOBAL general_log='ON';
which has the same effect (note that this is only possible in 5.1)
Another way of analysing this data would be to enable general query logging (just logging to file by adding general_log=1
to you my.cnf) and then to analyse the general query log with mk-query-digest
精彩评论