In general, login created in SQL Server, regardless of permission size, can see all of the databases in its SQL Server, which can be verified by the following T-SQL
IF EXISTS(SELECT * fromSys.server_principals SPWHEREName= 'Test') DROPLOGIN TestGO CREATELOGIN Test withPASSWORD= 'Test' GO --Check if test has permission to view any database and connect to SQL Server EXECUTE asLogin= 'Test' SELECT Suser_name() LoginName,user_name() Dbusername, Has_perms_by_name (NULL,NULL,'VIEW any DATABASE') Hasviewanydb, Has_perms_by_name (NULL,NULL,'CONNECT SQL') Hasconnectsql REVERT
View Code
Do not map login to database, select Database properties, modify owner for that login, execute
Use theGODENY VIEW any DATABASE to GO
Note that login to SQL with this login, is the permission of SA, the Permission Control section has not found the method of control temporarily
How to make a logged-in Longin link to SQL Server, you can only see the database that has permissions in the database