Cubsoft
Cubsoft

Reputation: 1157

Permit access to SQL Server?

I was just wondering if there are any access methods or rules to prevent people from accessing a database? I'm pretty new to sql so if so, how would you implement a method or rule to a database? Is it through properties of the database, or does it have to be written in SQL script somewhere?

I am using Microsoft SQL Server 2008.

Any help appreciated, thanks in advance.

Upvotes: 0

Views: 771

Answers (2)

dougajmcdonald
dougajmcdonald

Reputation: 20047

At a high level:

To allow a user access you need to have a login present at server level (the level higher than your DB's). There will be a 'Security' node at the server level where you can 'add login'. Depending on whether you're using windows user accounts (integrated security) or sql server logins the precise format of the logins will vary, but the user added will want to match the format of the accounts you are using.

Once you have granted a user access to the server in terms of a server login, you can then grant permissions at a database level. There will also be a 'Security' node at database level where you can add a new login at database level.

The database level login needs to match or be mapped to a login at server level.

At database level you can grant/deny all kinds of permissions, but it would be common to grant roles to a user, SQL includes built in roles such as 'datareader'/'datawriter' which are often used for 'generic access'

The image Diego posted illustrates in the GUI where to find some of these options, but the permutations are lengthy and it would be hard to explain any more without knowing some specifics about what you are trying to do.

Upvotes: 2

Diego
Diego

Reputation: 36146

Read about Logins and Users.

Logins protect you at a server level and Users at a database level. A user usually inherits a login's information.

you can see them on SSMS:

enter image description here

there is no point on writing too much as you can simple google it and find tons of explanations

Upvotes: 2

Related Questions