MySQL FAQs

From Hostek.com Wiki
Revision as of 19:42, 4 June 2013 by Jonc (Talk | contribs)

Jump to: navigation, search

How do I see all running processes in MySQL?

  1. Open up a command prompt on your server
  2. Log into MySQL with this command:
    mysql -u root -p
  3. Enter your root MySQL password when prompted
  4. 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>;