---
title: "Prepare MySQL database configuration | Grafana Labs"
description: "Learn how to create a monitoring user account in MySQL and prepare the database connection details"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Prepare MySQL database configuration

In this milestone, you prepare the MySQL database configuration required for monitoring. This includes creating a dedicated monitoring user account with the necessary permissions and gathering the connection details needed for Grafana.

Creating a dedicated monitoring user with minimal required privileges follows security best practices and ensures that the monitoring system has only the access it needs to collect metrics and logs.

**Prerequisites**:

- Check if the MySQL server is up and running.
- Make sure that your firewall is open for MySQL server (default port is `3306`).

To prepare your MySQL database configuration, complete the following steps:

Watch video -&gt;

1. Connect to your MySQL server as an administrative user:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   mysql -u root -p
   ```
2. Create a dedicated monitoring user for Grafana:
   
   SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```sql
   CREATE USER 'grafanaReader' IDENTIFIED BY 'password';
   ```
3. Grant the necessary privileges for monitoring:
   
   SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```sql
   GRANT SELECT ON performance_schema.* TO 'grafanaReader';
   ```
4. Exit the MySQL client:
   
   SQL ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```sql
   EXIT;
   ```
5. Test the monitoring user connection:
   
   Bash ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy
   
   ```bash
   mysql -u grafanaReader -p -e "SHOW STATUS LIKE 'Uptime';"
   ```

In the next milestone, you’ll add the MySQL data source to your Grafana Cloud instance.

* * *

### More to explore (optional)

- [Adding data sources to Grafana (video)](https://www.youtube.com/watch?v=cqHO0oYW6Ic&list=PLDGkOdUX1Ujo27m6qiTPPCpFHVfyKq9jT&index=8)
- [Data source plugins for Grafana](/grafana/plugins/data-source-plugins/)
