MySQL FAQs
From Hostek.com Wiki
How do I see all running processes in MySQL?
- Open up a command prompt on your server
- Log into MySQL with this command:
mysql -u root -p
- Enter your root MySQL password when prompted
- Issue this command:
SHOW FULL PROCESSLIST\G
MySQL will display a full list of running processes along with the state of the query and the SQL being ran at that time.
VPS - How do I log slow queries?
You can set the this options in the my.cnf/my.ini option files
log_slow_queries = 1 slow_query_log_file = <some file name>
If your server is above 5.1.6 you can set the slow query log in the runtime itself. For which you have to execute these queries (as root).
set global log_slow_queries = 1; set global slow_query_log_file = <some file name>;