Software⏱️ 2 min read📅 2026-05-31

How to Fix: mssql '5 (Access is denied.)' error during restoring database

Access denied error during database restore in SQL Server Management Studio.

Quick Answer: Check if the SQL Server service is running and set the correct permissions for the user account attempting to restore the database.

The 'Access is denied' error during database restoration in SQL Server Management Studio can be caused by a few reasons. When you select the file from the device and attempt to restore it, SQL Server may not have the necessary permissions to access the file or its location.

✅ Best Solutions to Fix It

Method 1: Change Permissions on the File Location

  1. Step 1: Open File Explorer and navigate to the location of the database file (E:\Program Files\Microsoft SQL Server\\DATA\xxxxxx.mdf).
  2. Step 2: Right-click on the file and select 'Properties'.
  3. Step 3: Click on the 'Security' tab and then click on 'Edit'.
  4. Step 4: Add your SQL Server username to the list of users with read permissions.

Method 2: Run SQL Server as an Administrator

  1. Step 1: Open SQL Server Management Studio.
  2. Step 2: Right-click on the server instance and select 'Properties'.
  3. Step 3: In the 'Security' tab, click on 'Add User' and add your SQL Server username to the list of users with read permissions.

🎯 Final Words

To avoid this error in the future, make sure that your SQL Server username has the necessary permissions to access the file location. If you are still experiencing issues, try running SQL Server as an administrator or changing the permissions on the file location.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions