The server principal 'MyUser' is not able to access the database 'NotMyDB' under the current security context (Microsoft SQL Server, Error:916)

Problem

You get the following error messages when you try to access your Microsoft SQL Server database with SQL Server Management Studio. The database may not be yours if you host your database in a shared server.

        The server principal 'MyUser' is not able to access the database 'NotMyDB' 
        under the current security context (Microsoft SQL Server, Error:916)
    

Solution

The problem is caused by the auto close status of the databases. We need to turn off the "auto close" of the database. Please follow these steps.

1) Get a database list

Go to SQL Server Management Studio > Management > SQL Server Logs. Open the current logs and find "Starting up database 'DBName'". Write the 'DBName' list.

2) Turn off "Auto Close" for the databases

Go to SQL Server Management Studio > Databases. Right click the database name and choose "Properties". Click "Options" in the left side and change "Auto Close" from "True" to "False".

Related Resources

Navigator

Other Knowledgebase Articles

Basic SQL Hosting

# of Domains: 4
# of SQL Server Databases: 4
Disk Space: 50GB
Bandwidth: Unmetered
SQL Server 2016
Monthly: $4.99
More Information About Basic Shared SQL Server Hosting Plan

Express Hyper-V Hosting

Dedicated Memory:2GB
Disk Space: 120GB
Bandwidth: Unmetered
Windows 2016/2012: Free
Monthly: $11.99
More Information About Express Windows Hyper-V Server

Dedicated SQL Server

CPU: Quad-Core X3440 CPU
RAM: 16GB RAM
Disk: 2x120GB SSD + 300GB SATA
RAID: RAID 1
Bandwidth: Unmetered
Windows 2016/2012: Free
Monthly: $79.00
More Information About Dedicated SQL Server with SSD
Managed Kubernetes Hosting | Windows VPS Hosting | SQL Server Hosting | ASP.NET Hosting | DNN Hosting | Windows Hyper-V Hosting