Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to make SQL users see only the libraries they have permission to

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

How to make SQL users only see the libraries they have permissions? I believe that many inexperienced people are at a loss about this. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Take SQL Server 2012 as an example

The above picture is a screenshot of part of the database, which we execute

The code is as follows:

DENY VIEW any DATABASE to PUBLIC

Then execute it to the Best user of the Best library

The code is as follows:

ALTER AUTHORIZATION ON DATABASE::Best TO Best

After logging in, Best users in Explorer can only display Best libraries, and execute the same SQL for Mine users of Mine libraries.

The code is as follows:

ALTER AUTHORIZATION ON DATABASE::Mine TO Mine

Mine users can only display the Mine database after logging in, which achieves our goal. When assigning permissions, remember to map the permissions of the corresponding database to the corresponding users to prevent cross-database operations.

After reading the above, do you know how to make SQL users see only the libraries they have permissions? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report