Forum Moderators: open

Message Too Old, No Replies

MySql log of commands

         

NielsSloth

2:10 pm on Jan 21, 2006 (gmt 0)

10+ Year Member



Hi all

I posted earlier that I have problems with overload on a MySql database driving some websites on a Win 2003 web server, it blocks completely taking 98% of the CPU, according to Task Manager; the only solution is to restart the MySql service. The web sites have a lot of user interaction like forums, entering of data, free text search etc.

I have been trying to find out what is happening, and would like to find out which commands that overloads the database.

Is it possible to see a log of commands that is sent to the database in a given time? Or to set up a system that logs the commands?

Thanks.

Niels from Denmark.

wakahii

3:01 pm on Jan 21, 2006 (gmt 0)

10+ Year Member



This will certainly do it for you for 20 sec[can change]. - mysql 4.x/5.x
Have included portion of my.ini file where you need to place.
The <folder/directory here> is the folder where you want it to log.

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306

#[ref: [dev.mysql.com...]
log-slow-queries="<folder/directory here>/MYSQL-SLOW.log"
long_query_time=20

NielsSloth

3:00 pm on Jan 22, 2006 (gmt 0)

10+ Year Member



Thank you for the code concerning the log. It does not exactly do what I need, however. It does not record all the commands that are issued through the .asp application that is accessed through the web, and that is what I needed.

I found out what caused the overload, by looking through the log files, see separate post about that.

Thanks

Niels from Denmark