Add Data Sources to Grafana on Windows
Step-by-step guide to connecting Grafana with the most popular data sources on Windows: Prometheus, InfluxDB, Loki, MySQL, PostgreSQL and Microsoft SQL Server.
How to add a data source
Open Connections
In Grafana go to Connections → Data sources.
Add new data source
Click Add new data source and search for the type you need.
Configure and Save & Test
Enter the URL, credentials and click Save & test. Grafana shows a green tick on success.
Prometheus
The most common data source for infrastructure metrics from windows_exporter and other exporters.
Type: Prometheus
URL: http://localhost:9090Loki (logs)
For log data from Promtail. See the Loki setup guide.
Type: Loki
URL: http://localhost:3100InfluxDB
For time series data. See the InfluxDB guide.
# InfluxDB 2.x (Flux)
Type: InfluxDB
Query language: Flux
URL: http://localhost:8086
Organisation: my-org
Token: your-api-token
Default Bucket: metrics
# InfluxDB 1.x (InfluxQL)
Type: InfluxDB
URL: http://localhost:8086
Database: telegraf
User/Password: grafana_reader / ****MySQL
Type: MySQL
Host: localhost:3306
Database: your_database
User: grafana_reader
Password: ****
-- Create read-only user (run in MySQL):
CREATE USER grafana_reader IDENTIFIED BY 'StrongPass';
GRANT SELECT ON your_database.* TO grafana_reader;
FLUSH PRIVILEGES;Microsoft SQL Server
Type: Microsoft SQL Server
Host: localhost:1433
Database: your_database
User: grafana_reader
Password: ****
-- Create read-only SQL login:
CREATE LOGIN grafana_reader WITH PASSWORD = 'StrongPass!';
USE your_database;
CREATE USER grafana_reader FOR LOGIN grafana_reader;
EXEC sp_addrolemember 'db_datareader', 'grafana_reader';PostgreSQL
Type: PostgreSQL
Host: localhost:5432
Database: your_database
User: grafana_reader
Password: ****
-- Create read-only Postgres user:
CREATE USER grafana_reader WITH PASSWORD 'StrongPass';
GRANT CONNECT ON DATABASE your_database TO grafana_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO grafana_reader;Troubleshooting
Connection refused
Service not running or port blocked by firewall. Check the firewall guide.
Authentication failed
Verify username and password. For SQL Server confirm the login has SELECT rights on the target database.
TLS/SSL errors
Enable Skip TLS verify for self-signed certs in internal environments.
No data in dashboards
Check the Grafana time range. Verify your query syntax matches the data source version.