metricsign
Start free
Medium severityauthentication

Power BI Refresh Error:
4064

What does this error mean?

The login's default database does not exist or the login has no access to it — SQL Server cannot complete the connection.

Common causes

  • 1The login's default database was dropped after the login was created
  • 2The login's default database was renamed
  • 3The login has no access to its default database

How to fix it

  1. 1Step 1: Change the login's default database to master or an existing DB: ALTER LOGIN [loginname] WITH DEFAULT_DATABASE = [master];
  2. 2Step 2: Grant the login access to its intended default DB: USE [targetdb]; CREATE USER [loginname] FOR LOGIN [loginname];
  3. 3Step 3: As a workaround in the connection string, explicitly set Initial Catalog to an accessible database to bypass the default DB check.

Frequently asked questions

Why did 4064 suddenly appear without any changes?

The most common cause is that the default database was dropped or detached. Run: SELECT default_database_name FROM sys.server_principals WHERE name = 'loginname' to confirm.

Can I fix 4064 without access to SSMS?

Yes — connect with sqlcmd using the -d flag to override the default database: sqlcmd -S server -U login -P pass -d master, then run ALTER LOGIN.

Does Azure SQL Database have error 4064?

Yes — it's the same error. Specify the database explicitly in the connection string (Initial Catalog) to work around it while you fix the default DB.

Official documentation: https://learn.microsoft.com/en-us/sql/relational-databases/errors-events/mssqlserver-4064-database-engine-error

Other authentication errors