docs/sources/datasources/mssql/troubleshooting/index.md
This document provides solutions to common issues you may encounter when configuring or using the Microsoft SQL Server (MSSQL) data source in Grafana.
These errors occur when Grafana cannot establish or maintain a connection to the Microsoft SQL Server.
Error message: "Unable to open tcp connection" or "dial tcp: connection refused"
Cause: Grafana cannot establish a network connection to the SQL Server.
Solution:
1433.Error message: "Connection timed out" or "I/O timeout"
Cause: The connection to SQL Server timed out before receiving a response.
Solution:
Error message: "TLS handshake failed" or "certificate verify failed"
Cause: There is a mismatch between the encryption settings in Grafana and what the SQL Server supports or requires.
Solution:
Error message: "Cannot connect to named instance" or connection fails when using instance name
Cause: Grafana cannot resolve the SQL Server named instance.
Solution:
hostname\instancename or hostname\instancename,port in the Host field.hostname,port.These errors occur when there are issues with authentication credentials or permissions.
Error message: "Login failed for user 'username'" or "Authentication failed"
Cause: The authentication credentials are invalid or the user doesn't have permission to access the database.
Solution:
DOMAIN\User).Error message: "Cannot open database 'dbname' requested by the login"
Cause: The authenticated user doesn't have permission to access the specified database.
Solution:
Verify that the database name is correct in the data source configuration.
Ensure the user is mapped to the database with appropriate permissions.
Grant at least SELECT permission on the required tables:
USE [your_database]
GRANT SELECT ON dbo.YourTable TO [your_user]
Check that the user doesn't have any conflicting permissions from the public role.
Error message: "Kerberos authentication failed" or "Cannot initialize Kerberos"
Cause: Kerberos configuration is incorrect or incomplete.
Solution:
krb5.conf) path is correct in the data source settings.{{< admonition type="note" >}} Kerberos authentication is not supported in Grafana Cloud. {{< /admonition >}}
Error message: "AADSTS error codes" or "Azure AD authentication failed"
Cause: Azure Entra ID (formerly Azure AD) authentication is misconfigured.
Solution:
For App Registration authentication:
For Managed Identity authentication:
managed_identity_enabled = true is set in the Grafana server configuration.For Current User authentication:
user_identity_enabled = true is set in the Grafana server configuration.user_impersonation for Azure SQL).For detailed Azure authentication configuration, refer to Configure the Microsoft SQL Server data source.
These errors occur when there are issues with query syntax or configuration.
Error message: "Could not find time column" or time series visualization shows no data
Cause: The query doesn't return a properly formatted time column for time series visualization.
Solution:
time when using the Time series format.$__time() macro to rename your date column: $__time(your_date_column).datetime, datetime2, date) or contains Unix epoch values.ORDER BY.Error message: "Error parsing query" or macros appear unexpanded in the query
Cause: Grafana macros are being used incorrectly.
Solution:
$__timeFilter(column) not $_timeFilter(column).Cause: Time series data appears shifted or doesn't align with expected times.
Solution:
Store timestamps in UTC in your database to avoid timezone issues.
Time macros ($__time, $__timeFilter, etc.) always expand to UTC values.
If your timestamps are stored in local time, convert them to UTC in your query:
SELECT
your_datetime_column AT TIME ZONE 'Your Local Timezone' AT TIME ZONE 'UTC' AS time,
value
FROM your_table
Don't pass timezone parameters to time macros—they're not supported.
Error message: "Result set too large" or browser becomes unresponsive
Cause: The query returns more data than can be efficiently processed.
Solution:
$__timeFilter(column) to limit data to the dashboard time range.AVG, SUM, COUNT) with GROUP BY instead of returning raw rows.TOP clause to limit results: SELECT TOP 1000 ....$__timeGroup() macro to aggregate data into time intervals.Cause: Stored procedure output isn't being captured correctly.
Solution:
SELECT statements, not just variable assignments.SET NOCOUNT ON if present, or ensure it's followed by a SELECT statement.For more information on using stored procedures, refer to the query editor documentation.
These issues relate to slow queries or high resource usage.
Cause: Queries take a long time to execute.
Solution:
WHERE clauses and time filters.Error message: "Too many connections" or "Connection pool exhausted"
Cause: Too many concurrent connections to the database.
Solution:
The following issues don't produce specific error messages but are commonly encountered.
Cause: Queries accidentally access system databases.
Solution:
tempdb, model, msdb, and master from the database dropdown.Cause: Variable queries return unexpected results or errors.
Solution:
Cause: Data formatting or type conversion issues.
Solution:
SELECT value AS metric.NULL values that might affect aggregations.FILL option in $__timeGroup() macro to handle missing data points.If you continue to experience issues after following this troubleshooting guide:
When reporting issues, include: