Difference between revisions of "MySQL FAQs"
(Created page with "==How do I see all running processes in MySQL?== #Open up a command prompt on your server #Log into MySQL with this command: <pre>mysql -u root -p</pre> #Enter your root MySQL...") |
|||
(One intermediate revision by one other user not shown) | |||
Line 7: | Line 7: | ||
MySQL will display a full list of running processes along with the state of the query and the SQL being ran at that time. | 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 | ||
+ | |||
+ | <pre> | ||
+ | log_slow_queries = 1 | ||
+ | slow_query_log_file = <some file name> | ||
+ | </pre> | ||
+ | |||
+ | 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). | ||
+ | |||
+ | <pre> | ||
+ | set global log_slow_queries = 1; | ||
+ | set global slow_query_log_file = <some file name>; | ||
+ | </pre> | ||
+ | |||
+ | ==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. | ||
+ | |||
+ | __FORCETOC__ | ||
[[Category:Databases-MySQL]] | [[Category:Databases-MySQL]] |
Latest revision as of 20:10, 7 March 2014
Contents
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>;
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.