How to enable log-slow-queries in mysql?

How to enable log-slow-queries in mysql?

Hi,

I’m seeing some high loads on the server with mysql on top with 98% cpu usage and I want to know what the cause is. I suspect some crappy query in a non-optimized table from one of my clients. So, I read about the –log-slow-queries option but I can’t figure out how to kill them mysql processes without breaking all websites on the server.

Versions
OS: CentOS 5.5
MySQL: Ver 5.0.67-community for pc-linux-gnu on i686 (MySQL Community Edition (GPL))

What I tried: /usr/sbin/mysqld –log-slow-queries (under root)
and gave this output:


120404 20:46:12 [Warning] Asked for 196608 thread stack, but got 126976
120404 20:46:12 [ERROR] Fatal error: Please read "Security" section of the manua l to find out how to run mysqld as root!

120404 20:46:12 [ERROR] Aborting

120404 20:46:12 [Note] /usr/sbin/mysqld: Shutdown complete

I think I’m quite close but I just don’t understand how I can gracefully restart mysql with the log option without breaking all running sites. Any help is welcome, tnx 🙂

Comments are closed.