【问题标题】:Connection string to connect to a local SQL Server database using windows authentication使用 Windows 身份验证连接到本地 SQL Server 数据库的连接字符串
【发布时间】:2016-12-01 21:30:25
【问题描述】:

我在 Windows Server 2008 上运行,我想将我的应用程序连接到本地 SQL Server 数据库。

我已阅读:https://codedark.xyz/blog/connecting-to-ms-sql-server-with-knex

我已启用与服务器的 TCP/IP 连接以及 SQL Server 的默认端口 1433。然后我重新启动了服务器实例。

我正在尝试使用 Windows 身份验证进行连接,我的连接字符串如下所示:

mssql: {
client : "mssql",
connection: {
  server : "localhost",
  user : "windowsusername",
  password : "windowspassword",
  options: {
    port: 1433,
    database : "mydb",
    encrypt: true
  }
},
}

我收到此错误:

用户“windowsuser”登录失败

我的问题:是否可以使用 Windows 身份验证连接到本地 SQL Server 数据库?如果是,哪些是正确的凭据?

【问题讨论】:

    标签: sql-server


    【解决方案1】:

    如果您希望使用我推荐的 Windows 身份验证,请删除用户和密码信息并尝试以下操作:

    Integrated Security: "SSPI"
    

    根据您的设置,使用 Windows 身份验证可能会很困难,除非您可以将连接字符串指定为实际字符串而不是对象。

    有关更多信息,请参阅此问题Stack Reference

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-07
      相关资源
      最近更新 更多