Hi there,
I am setting up a database for the first time using SQL Server Express.
I have managed to create a database and create a table with data etc, all straight forward.
The problem I am having is when I come to creating a user for the database. I have the following users in there already, which I am guessing are put in by default:
dbo
guest
INFORMATION_SCHEMA
sys
When I try creating a new user via this screen I get the following error:
TITLE: Microsoft SQL Server Management Studio Express
Create failed for User 'growstudiouser'. (Microsoft.SqlServer.Express.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+User&LinkId=20476
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)
'growstudio' is not a valid login or you do not have permission. (Microsoft SQL Server, Error: 15007)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=15007&LinkId=20476
I was wondering if anybody could advise me as to what I'm doing wrong. I am typing in the name as "growstudiouser" and the login name as "growstudio".
Or am I just using the wrong section to do what I want. I'm trying to create a user so that when the database is built I can connect to it using a username and password that I have created. I'm not sure I'm taking to the correct route as there is no password option anywhere when creating a new user.
Thanks in advance,
Kevin
hi Kevin,
usually a database user is associated with a server's login, if you do not define a user as
USE tempdb; GO CREATE USER testUser WITHOUT LOGIN WITH DEFAULT_SCHEMA = dbo; GO DROP USER testUser;where the database user is not associated with a server level principal, but this is another story..
so you should first create the server login as
USE master; CREATE LOGIN testLogin WITH PASSWORD = 'his strong password'; GO USE tempdb; GO CREATE USER testUser FOR LOGIN testLogin WITH DEFAULT_SCHEMA = dbo; GO DROP USER testUser; GO USE master; GO DROP LOGIN testLogin;regards
|||SQL Server follows two level security architecture. Login and User . Login is to access to the server. If you have login it does not mean that you have access to all the databases in that server. NO. To access database, the Login has to be mapped/added to the database as user. So , in your case what your are probably doing is you are not maping the user with a login . You should select a login while creating user
Madhu
No comments:
Post a Comment