# Monitoring the MySQL database for WordPress using Query Monitor

> Install the Query Monitor plugin to view and analyse the MySQL queries your WordPress site runs and spot slow ones.

Source: https://helpcenter.ruachost.com/wordpress/guides/monitoring-the-mysql-database-for-wordpress-using-query-monitor/

The **Query Monitor plugin** is a powerful tool for debugging and monitoring WordPress performance. It allows developers to view and analyze **MySQL queries** in real time, helping to identify slow or problematic queries that may affect site speed. On **ruachost.com**, Query Monitor is fully supported and can be installed directly from the WordPress dashboard.

## Why Use Query Monitor?

- Detects slow or duplicate database queries.
- Shows queries grouped by plugins, themes, or functions.
- Helps troubleshoot performance bottlenecks.
- Provides insights into PHP errors, hooks, and HTTP requests.

## Steps to Install and Configure Query Monitor

1. **Log in to WordPress** with an administrator account.
2. In the dashboard, go to **Plugins → Add New**.
3. Search for **Query Monitor**.
4. Click **Install Now**, then **Activate**.
5. After activation, go to **Plugins → Installed Plugins → Query Monitor → Settings**.
6. The Query Monitor panel will appear at the bottom of your WordPress admin screen.

## Using Query Monitor to Monitor MySQL

- Open any WordPress page in the admin dashboard.
- Scroll down to the Query Monitor panel.
- You’ll see detailed information including:

  - **Database Queries** → List of queries executed on the page.
  - **Query Time** → Execution time for each query.
  - **Duplicate Queries** → Queries that run multiple times unnecessarily.
  - **Query Source** → Which plugin, theme, or function triggered the query.
- Use this information to optimize your database and improve site performance.

## Important Notes

- Query Monitor is intended for **developers and administrators**.
- It should not be left active on production sites for long periods due to overhead.
- Always test changes on a staging environment before applying them live.
