> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mindsdb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MindsDB and Grafana

[Grafana](https://grafana.com/) is an open-source analytics and interactive visualization web application
that allows users to ingest data from various sources, query this data, and display it on customizable charts for easy analysis.

## How to Connect

To begin, set up Grafana by following one of the methods outlined in the [Grafana Installation Documentation](https://grafana.com/docs/grafana/latest/setup-grafana/installation/#supported-operating-systems).

Once Grafana is successfully set up in your environment, navigate to the Connections section, click on Add new connection, and select the MySQL plugin
, as shown below.

<p align="center">
  <img src="https://mintcdn.com/mindsdb/qZ0qlWEqCb1K2Drt/assets/sql/grafana_1.png?fit=max&auto=format&n=qZ0qlWEqCb1K2Drt&q=85&s=67e876353cc5dd88fb7728d4e49d1fdc" width="1916" height="742" data-path="assets/sql/grafana_1.png" />
</p>

Now it's time to fill in the connection details.

<p align="center">
  <img src="https://mintcdn.com/mindsdb/qZ0qlWEqCb1K2Drt/assets/sql/grafana_2.png?fit=max&auto=format&n=qZ0qlWEqCb1K2Drt&q=85&s=b85cb3812d0dee1ba9e45dc1a123a8ac" width="1920" height="1397" data-path="assets/sql/grafana_2.png" />
</p>

There are three options, as below.

<Tabs>
  <Tab title="Local MindsDB">
    You can connect to your local MindsDB. To do that, please use the connection details below:

    ```
    Host: `127.0.0.1:47335`
    Username: `mindsdb`
    Password: <leave it empty>
    Database: <leave it empty>
    ```
  </Tab>
</Tabs>

Now we are ready to Save & test the connection.

## Testing the Connection

Click on the `Save & test` button to check if all the provided data
allows you to connect to MindsDB.

On success, you should see the message, as below.

<p align="center">
  <img src="https://mintcdn.com/mindsdb/qZ0qlWEqCb1K2Drt/assets/sql/grafana_3.png?fit=max&auto=format&n=qZ0qlWEqCb1K2Drt&q=85&s=885e29fc28c0a93e47cf52df0096fff7" width="1588" height="247" data-path="assets/sql/grafana_3.png" />
</p>

## Examples

### Querying

To verify the functionality of our MindsDB database connection,
you can query data in the Explore view. Use the text edit mode to compose your queries.

```sql theme={null}
SHOW FULL DATABASES;
```

On execution, we get:

<p align="center">
  <img src="https://mintcdn.com/mindsdb/qZ0qlWEqCb1K2Drt/assets/sql/grafana_4.png?fit=max&auto=format&n=qZ0qlWEqCb1K2Drt&q=85&s=b3fec481737b5ff45341126faaaf78cf" width="1920" height="876" data-path="assets/sql/grafana_4.png" />
</p>

### Visual Query Builder

Now you can build a dashboard with a MindsDB database connection.
Example query :

```sql theme={null}
CREATE DATABASE mysql_demo_db
WITH ENGINE = "mysql",
PARAMETERS = {
   "user": "user",
   "password": "MindsDBUser123!",
   "host": "samples.mindsdb.com",
   "port": "3306",
   "database": "public"
   };

SELECT * FROM mysql_demo_db.air_passengers;
```

On execution, we get:

<p align="center">
  <img src="https://mintcdn.com/mindsdb/qZ0qlWEqCb1K2Drt/assets/sql/grafana_5.png?fit=max&auto=format&n=qZ0qlWEqCb1K2Drt&q=85&s=393653661bd733d5821f28505438914c" width="1913" height="877" data-path="assets/sql/grafana_5.png" />
</p>

<Tip>
  How to [whitelist MindsDB Cloud IP address](/faqs/whitelist-ips)?
</Tip>

## What's Next?

Now that you are all set, we recommend you check out our **Tutorials** and
**Community Tutorials** sections, where you'll find various examples of
regression, classification, and time series predictions with MindsDB.

To learn more about MindsDB itself, follow the guide on
[MindsDB database structure](/sql/table-structure/). Also, don't miss out on the
remaining pages from the **SQL API** section, as they explain a common SQL
syntax with examples.

Have fun!
