我有 SQL Server 2008,被迫创建新的 Windows 7 配置文件。我无法再连接到我的(本地)数据库。
我尝试使用 Windows 身份验证登录时,我得到了
无法连接到(本地)。
用户“MyAccount”登录失败。(.Net SqlClient 数据提供程序)
Server Name: (local) Error Number: 18456 Severity: 14 State: 1 Line Number: 65536 ------------------------------ Program Location:
在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException 异常,布尔 breakConnection)
在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
在 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)
在 System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(布尔 enlistOK)
在 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo,String newPassword,Boolean ignoreSniOpenTimeout,Int64 timerExpire,SqlConnection owningObject)
在System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host、String newPassword、Boolean redirectedUserInstance、SqlConnection owningObject、SqlConnectionString connectionOptions、Int64 timerStart)
位于 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject、SqlConnectionString connectionOptions、String newPassword、Boolean redirectedUserInstance)
位于 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity 身份、SqlConnectionString connectionOptions、对象提供程序信息、String newPassword、SqlConnection owningObject、Boolean redirectedUserInstance)
位于 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions 选项、对象 poolGroupProviderInfo、DbConnectionPool 池、DbConnection
在 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
在 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) 在 System.Data.ProviderBase.DbConnectionClosed.OpenConnection
(DbConnection outerConnection, DbConnectionFactory connectionFactory)在
System.Data.SqlClient.SqlConnection.Open()
在 Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ValidateConnection(UIConnectionInfo ci, IServerType server)
在 Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
我没有安装 SQL Server 2008。我的公司安装了,但我联系的支持人员无法提供帮助。
我取得了一些进展,能够使用基于的 Windows 身份验证通过“SQLEXPRESS”登录韦恩的回答。
我有 2 个服务
SQL Server (MSSQLSERVER) - tried to log in but won't let me in
SQL Server (SQLEXPRESS) - let me in
我正在尝试让(本地)继续工作。所以我不确定我是否可以使用这个新帐户来帮助我。
===================================
Cannot connect to .\MSSQLSERVER.
===================================
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid) (.Net SqlClient Data Provider)
------------------------------
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=87&LinkId=20476
------------------------------
Error Number: 87
Severity: 20
State: 0
------------------------------
Program Location:
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ObjectExplorer.ValidateConnection(UIConnectionInfo ci, IServerType server)
at Microsoft.SqlServer.Management.UI.ConnectionDlg.Connector.ConnectionThreadUser()
编辑
当我检查日志时,我看到了这个
2012-01-17 11:17:45.39 Logon Error: 18456, Severity: 14, State: 11.
2012-01-17 11:17:45.39 Logon Login failed for user 'MyAccount'. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: <local machine>]
答案1
你创建了一个新的轮廓或全新帐户?它们是截然不同的东西,而且这里的差异非常相对。如果您创建了一个全新的帐户,那么该新帐户需要被授予对默认实例的访问权限。
如果您刚刚创建了一个新的 Windows 配置文件,那么如果您尝试使用您的机器的主机名进行连接,它是否有效?
编辑:
根据您的更新,您使用了错误的连接方式。您只想使用普通主机名连接到默认实例。您不想使用完全限定名称。基本上,没有名为 MSSQLSERVER 的实例。它只是为默认实例运行的服务提供的标签。
答案2
表示State 1
您在此处发布的错误消息是通用登录失败错误代码
找到你的SQL Server 错误日志并使用本文确定问题的真正原因。
摘自上述文章中有关登录失败错误状态的内容:
ERROR STATE ERROR DESCRIPTION
2 and 5 Invalid userid
6 Attempt to use a Windows login name with SQL Authentication
7 Login disabled and password mismatch
8 Password mismatch
9 Invalid password
11 and 12 Valid login but server access failure
13 SQL Server service paused
18 Change password required