Grafana 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.

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.

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

There are three options, as below.

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>

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.

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.

SHOW FULL DATABASES;

On execution, we get:

Visual Query Builder

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

CREATE DATABASE mysql_demo_db
WITH ENGINE = "mysql",
PARAMETERS = {
   "user": "user",
   "password": "MindsDBUser123!",
   "host": "db-demo-data.cwoyhfn6bzs0.us-east-1.rds.amazonaws.com",
   "port": "3306",
   "database": "public"
   };

SELECT * FROM mysql_demo_db.air_passengers;

On execution, we get:

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. 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!