Nigel Whitworth's Development Site

You are currently not logged in.

SQL Security

Whereas with Oracle DB, you simple use the 'Create User' command, in SQL Server, user management is down by stored procedures.

sp_addlogin @loginname, @password, @defdb
It's quite explanatory really, you replace the parameters above with the user, password and default database that the user is being set up for.

sp_adduser @loginname, @name_in_db, @defdb
Once you have created a login, you will need to create the user. The parameters should be self-explanatory. You don't need to specify a defdb but it can help.

sp_grantlogin @login
Unlike the first command, this commad will grant access to a trusted network user. The login parameter should include both the domain followed by a forwards slash then the user name.

GRANT
Grant command assigns permissions to various parts of the database. Where I use usera, this can be a user or a name of a group.

ExamplesDescription
Grant Select on tablea to useraAllow usera to view records from tablea
Grant Insert, Update, Delete on tablea to useraAllow usera to delete, insert and update records in tablea
Grant Alter Table on tablea to useraGive permission for tablea to alter the table.
Grant Create Table,
Create Procedure
Create Trigger,
Create Rule,
Create View
to usera
Assign the relevent permission to usera
Grant Update (columns) on tablea to useraGrant permission to update a list of fields in tablea to usera. Works equally well with Select but not Insert or Delete.

If you intend to vote or make a comment, please enter the security code.

Make a comment

*Comments are the views of individuals, they may or may not be correct.
All comments are reviewed and accepted or rejected.
If you give an email address, you will be sent an email when someone makes a comment on this page.*

Name :
Email :
Comments :


Only name and Code is compulsory.
 
 
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)