Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
621 views
in Technique[技术] by (71.8m points)

user accounts - How to add Sysadmin login to SQL Server?

I have installed SQL Server 2008 using Windows Authentication in my laptop for my own use. I want to add Sysadmin account/role using SQL Server Login type. I checked this post, but it's not showing what I need. How can I add the sysadmin account? By right shouldn't it be the default role/login?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

sysadmin is a server role; it can be applied to any login.

When installing SQL Server a login sa is created with this privilege; you can specify the password when you're installing SQL Server.

Or you can create your own login:

CREATE LOGIN adminuser WITH PASSWORD = 'ABCDegf123';
GO

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

enter image description here

This all assumes Mixed-Mode authentication is set up to allow SQL logins. Change Server Authentication Mode.

After comment:

So from the link above to change to Mixed-mode in Management Studio you would:

  1. In SQL Server Management Studio Object Explorer, right-click the server, and then click Properties.

  2. On the Security page, under Server authentication, select the new server authentication mode, and then click OK.

  3. In the SQL Server Management Studio dialog box, click OK to acknowledge the requirement to restart SQL Server.

  4. In Object Explorer, right-click your server, and then click Restart. If SQL Server Agent is running, it must also be restarted.

It should look something like this:

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...