Am created a login and an user to access sql server instance and the database.

Creating Login: create login xxx with password='secret';
 Creating User:  use testdb;
                 create user yyy for login loginname;

And then i login with this login name(xxx) and also i can able to access the database(testdb).

I can't able to create a schema and also one more thing to ask, how can i give admin role to the users(yyy). Thanks in advance.

Recommended Answers

All 10 Replies

Every user logs in into its own schema.

Did you log in through an admin account and tried to grant admin role to the user ?

hi jacksantho

search for the sql configuration file in the c drive(i hope this is the drive where os is installed )and there update your password with username and save it..
then u can login with disered name and passowrd..

Did you log in through an admin account and tried to grant admin role to the user ?

How to grant admin role to the user?

Any standard (non admin)user can't grant admin role to another user, only an admin can do that.

So you need to log in through any user which is an admin account to grant admin role.

Can you give me the query ?

What query ?

login as root(admin)from mysql console and then u can create a new user. as root is the admin you can create other user.

i need transact-sql

First of all you need to log in as admin user to run any script.

This will add a user to the sysadmin role:

EXEC master..sp_addsrvrolemember @loginame = 'username', @rolename = N'sysadmin'

Hint: If you have MS management studio you can create a user with all the roles (db or server) and instead of hitting OK you select Script from the top of the window and get a script that will do the same job as hitting the OK button.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.