Symptoms
MS SQL database users are able to see names of MS SQL databases which are not owned by them.
Cause
Default MS SQL server behavior.
Resolution
Warning: User’s databases will not be listed in MS SQL Management Studio after the solution below.
Note: ‘MASTER’ and ‘TEMPDB’ databases will always be visible to all users. It is not possible to make them invisible.
To revoke the permissions, do the following:
-
Connect to the server via RDP.
-
Open SQL Server Management Studio either locally, or via remote connection. Or use any web admin like MyLittleAdmin to access the database (Tools & Settings > Database Servers > Web admin).
-
Select the master database from the list of databases. Once the database is selected, click the button New Query.
-
Run the following SQL query to hide databases for all users:
USE master;
REVOKE VIEW ANY DATABASE TO PUBLIC;
GOIt is possible to revert changes using the following query:
USE master;
GRANT VIEW ANY DATABASE TO PUBLIC;
GO
Â