Microsoft SQL Server is referencing the wrong disk drives in the Windows Registry (Regedit)? Possible causes and fixes:
1. Check SQL Server Installation Path in Registry
- Open Regedit (Win + R → type regedit → Enter).
- Go to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server
- Look for incorrect paths under:
- Setup
- Instance Names
- Instance ID
2. Verify SQL Server Configuration Manager
- Open SQL Server Configuration Manager
- Go to SQL Server Services
- Right-click SQL Server (Instance Name) → Properties
- Under Startup Parameters, check the paths for:
- -d (Database file)
- -l (Log file)
- -e (Error logs)
- If incorrect, update accordingly.
3. Check Default Data & Log File Locations
Run this SQL query to check where SQL Server is looking for database files:
EXEC sp_helpfile;
If incorrect, update them using:
ALTER DATABASE [YourDB] MODIFY FILE (NAME = 'YourDB', FILENAME = 'C:\CorrectPath\YourDB.mdf');
sp_helpfile shows the files of the current database. MODIFY FILE only updates the catalog: take the database offline, move the file, then bring it online, and the new path takes effect then (NEEDS APPROVAL, it’s an outage for that database).
To see the instance’s default data and log locations:
SELECT SERVERPROPERTY('InstanceDefaultDataPath') AS default_data_path,
SERVERPROPERTY('InstanceDefaultLogPath') AS default_log_path;
4. Verify SQL Server System Registry Paths
- Go to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLnn.INSTANCENAME\MSSQLServer (for example MSSQL16.MSSQLSERVER for a SQL Server 2022 default instance)
- Check values for:
- DefaultData
- DefaultLog
- BackupDirectory
- SQLPath
5. Restart SQL Services
After making changes, restart SQL Server:
- Open Services.msc
- Restart SQL Server (MSSQLSERVER)
From my SQL Server DBA handbook.