MySQL FAQs

From Hostek.com Wiki
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>;

How to Handle Error: User does not have access to metadata required to determine stored procedure parameter types.

When using stored procedures in MySQL, you may come accross the error User does not have access to metadata required to determine stored procedure parameter types. In this case, you need to add SELECT permissions for the user trying to run the procedure.

To add the permissions, run the following queries within MySQL on your server (replacing USER with your MySQL user):

   GRANT SELECT ON mysql.proc TO 'USER'@'%';
   flush privileges;

Once completed you should no longer receive the error.