在 Windows 7 x64 中无法登录到 SQL Server 2008

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4752749/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 16:02:24  来源:igfitidea点击:

Cannot login to SQL Server 2008, in Windows 7 x64

sql-serverwindowssql-server-2008windows-7

提问by Dexter

Alright wasted hours and hours trying to get MSSQL Server 2008 to login via SQL Server Management Studio. It works fine in Windows XP computer, but in Windows 7 it does not work.

好吧,浪费了很多时间试图让 MSSQL Server 2008 通过 SQL Server Management Studio 登录。它在 Windows XP 计算机中工作正常,但在 Windows 7 中它不起作用。

Steps done:

完成的步骤:

  1. Install MSSQL, add logged-in administrator user in installation.
  2. type the correct hostname in the "login window" of SQL Server Management Studio.
  3. Error 18456 is returned with Windows authentication.
  4. SQL authentication, with username and password matching my windows account, does not work.
  5. Created a new user called it 'SQLServer', set the SQL account in 'Computer > manage > SQL Server > Properties' to 'use this account'. Restarted Service.
  6. Added SQLServer to Administrator group, and all the 'MSSQL' groups as well.
  7. Tried logging in with .\SQLServer and password that I set for SQL authentication method, no luck.
  8. Tried logging in with SQLServer and password, no luck either.
  1. 安装MSSQL,安装时添加登录管理员用户。
  2. 在 SQL Server Management Studio 的“登录窗口”中键入正确的主机名。
  3. Windows 身份验证返回错误 18456。
  4. 用户名和密码与我的 Windows 帐户匹配的 SQL 身份验证不起作用。
  5. 创建一个名为“SQLServer”的新用户,在“计算机>管理>SQL Server>属性”中将SQL帐户设置为“使用此帐户”。重新启动服务。
  6. 将 SQLServer 添加到管理员组,以及所有“MSSQL”组。
  7. 尝试使用我为 SQL 身份验证方法设置的 .\SQLServer 和密码登录,但没有成功。
  8. 尝试使用 SQLServer 和密码登录,也没有运气。

I also tried installing "Service Pack 1 of SQL Server 2008", but no luck.

我还尝试安装“SQL Server 2008 Service Pack 1”,但没有成功。

Essentially, I cannot figure out how to login to my own local MSSQL server.

本质上,我无法弄清楚如何登录到我自己的本地 MSSQL 服务器。

回答by Remus Rusanu

Follow the steps in Troubleshooting: Connecting to SQL Server When System Administrators Are Locked Out:

按照故障排除:系统管理员被锁定时连接到 SQL Server 中的步骤操作:

  • Start the instance of SQL Server in single-user mode by using either the -m or -f options.
  • Start command prompt as local administrator
  • Connect to the server: sqlcmd -E -S .
  • Add yourself (computername\username) to the sysadmin SQL group:

    create login [computername\username] from windows;
    exec sp_addsrvrolemember 'computername\username', 'sysadmin';

  • Restart the server in normal mode

  • 使用 -m 或 -f 选项以单用户模式启动 SQL Server 实例。
  • 以本地管理员身份启动命令提示符
  • 连接到服务器: sqlcmd -E -S .
  • 将您自己(计算机名\用户名)添加到 sysadmin SQL 组:

    create login [computername\username] from windows;
    exec sp_addsrvrolemember 'computername\username', 'sysadmin';

  • 以正常模式重启服务器

And next time pay attention to the options you click during Setup.

下次注意您在安装过程中单击的选项。

回答by Tarwn

Just to clear something up. The service account you keep changing is the account that SQL Server's services are running under on the computer and has nothing o do with what accounts are allowed to access it (this would be like changing the MySQL service to a root account and then a non-root account, so not an MS issue). As this has nothing to do with your ability to login (unless you have disabled the service somehow by giving it an account with limited rights), I would verify it is working and then leave that dialog alone.

只是为了澄清一些事情。您不断更改的服务帐户是在计算机上运行 SQL Server 服务的帐户,与允许访问它的帐户无关(这就像将 MySQL 服务更改为 root 帐户,然后是非root 帐户,所以不是 MS 问题)。由于这与您的登录能力无关(除非您通过授予其有限权限的帐户以某种方式禁用了该服务),我会验证它是否正常工作,然后不理会该对话框。

回答by SQLMenace

I would say take a look at this post http://sqlblog.com/blogs/andy_leonard/archive/2008/07/15/installing-sql-server-2008-rc0.aspx

我想说看看这篇文章http://sqlblog.com/blogs/andy_leonard/archive/2008/07/15/installing-sql-server-2008-rc0.aspx

and pay attention to this...notice the add current user and add... options??

并注意这个...注意添加当前用户和添加...选项??

Also notice mixed mode...it is all there

还要注意混合模式......它就在那里

alt text

替代文字

You can also change the account after the fact in the service itself

您也可以事后在服务本身中更改帐户