×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

“ 众所周知,sa 帐户是一个广为人知的 SQL Server 帐户,并且经常成为恶意用户的攻击目标。除非您的应用程序需要使用 sa 帐户,否则请不要启用它。为 sa 登录名使用一个强密码非常重要。” “sa 登录名只能使用 SQL Server 身份验证连接到服务器。”

如果您在安裝期間選取 Windows 驗證,安裝程式就會針對 SQL Server 驗證建立 sa 帳戶,但是此帳戶是停用的。

如果您之後變更為混合模式驗證,而且想要使用 sa 帳戶,就必須啟用此帳戶。
任何 Windows 或 SQL Server 帳戶都可以設定為系統管理員。
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / 求解 login failed for user 'sa'
    部署一个网站页面返回 login failed for user 'sa', 但 database server端可以成功用 sa登入,config文件密码没错,何解 ?
    • 不晓得。不过,我几乎从来不用sa账户,更不会给程序用。另外吧密码明文写在配置文件里似乎不那么保密,是否考虑用别的方法,在Windows上用Windows用户?
      • 谢谢。我是QA,尝试部署个网站自已测试用,所以不担心安全方面问题
        • login failed for user 'sa', 你怎么肯定是在database failed呢?你的application是什么authentication?
          • 我不肯定是database failed. config文件里的authentication mode是windows, database里是sql server and windows authentication mode. 是这个原因么?
            • Database那儿应该没问题,你的login failed应该是windows authentication问题。你的app是Microsoft的技术?你的电脑/domain里有没有sa的User? 另外,windows authentication,allow/deny是如何设置的?
              • app is C# asp.net. sa 是数据库user, 不是电脑domain user 数据库设置的是sql server and windows authentication mode
                • 1. 打开web.config; 2. 在<system.web> ...</<system.web>之间,加 <authorization> <allow users="*"/> </authorization> 小心</authorization>在web.config只能出现一次。
                  • 还是不行:(
    • Check the authentication mode under server properties
      • It is sql server and windows authentication mode
        • 试一下这个吧, 但你为什么要用windows authentication, 用SQL server authentication 比较简单。
          http://msdn.microsoft.com/en-us/library/vstudio/bsz5788z(v=vs.100).aspx
    • Check sql server log
      • extract of the log.... doubt if it is due to the database version
        本文发表在 rolia.net 枫下论坛2014-07-31 14:11:50.62 spid5s Starting up database 'msdb'.
        2014-07-31 14:11:51.99 服务器 A self-generated certificate was successfully loaded for encryption.
        2014-07-31 14:11:52.08 服务器 Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\SQLEXPRESS ].
        2014-07-31 14:11:52.08 服务器 Server local connection provider is ready to accept connection on [ \\.\pipe\MSSQL$SQLEXPRESS\sql\query ].
        2014-07-31 14:11:52.14 服务器 Dedicated administrator connection support was not started because it is not available on this edition of SQL Server. This is an informational message only. No user action is required.
        2014-07-31 14:11:52.49 服务器 SQL Server is now ready for client connections. This is an informational message; no user action is required.
        2014-07-31 14:11:52.53 spid8s Clearing tempdb database.
        2014-07-31 14:11:59.12 spid8s Starting up database 'tempdb'.
        2014-07-31 14:12:02.44 spid5s Recovery is complete. This is an informational message only. No user action is required.
        2014-07-31 14:12:02.72 spid11s The Service Broker protocol transport is disabled or not configured.
        2014-07-31 14:12:02.75 spid11s The Database Mirroring protocol transport is disabled or not configured.
        2014-07-31 14:12:05.23 spid11s Service Broker manager has started.
        2014-07-31 14:42:27.61 spid1s Server resumed execution after being idle 1790 seconds. Reason: timer event.
        2014-07-31 15:15:43.16 spid51 Starting up database 'db_BBS'.
        2014-07-31 15:15:45.53 spid20s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Object Plans' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
        2014-07-31 15:15:45.55 spid20s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'SQL Plans' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
        2014-07-31 15:15:45.55 spid20s SQL Server has encountered 1 occurrence(s) of cachestore flush for the 'Bound Trees' cachestore (part of plan cache) due to some database maintenance or reconfigure operations.
        2014-07-31 15:19:09.29 spid52 Using 'xpstar90.dll' version '2005.90.5000' to execute extended stored procedure 'xp_fixeddrives'. This is an informational message only; no user action is required.更多精彩文章及讨论,请光临枫下论坛 rolia.net
      • I don't see the error in this log
    • 贴上connection string了。。。
      • here it is
        <connectionStrings>
        <add name="myCon" connectionString="Data Source=localhost\sqlexpress;Initial Catalog=db_BBS;User ID=sa;Password=123456;"/>
        </connectionStrings>
        • try this one
          Data Source=localhost\sqlexpress;Initial Catalog=db_BBS;Integrated Security=True
          • 不行:(
            • #8908600@0 建个普通账户试一下就知道了。
    • “ 众所周知,sa 帐户是一个广为人知的 SQL Server 帐户,并且经常成为恶意用户的攻击目标。除非您的应用程序需要使用 sa 帐户,否则请不要启用它。为 sa 登录名使用一个强密码非常重要。” “sa 登录名只能使用 SQL Server 身份验证连接到服务器。”
      如果您在安裝期間選取 Windows 驗證,安裝程式就會針對 SQL Server 驗證建立 sa 帳戶,但是此帳戶是停用的。

      如果您之後變更為混合模式驗證,而且想要使用 sa 帳戶,就必須啟用此帳戶。
      任何 Windows 或 SQL Server 帳戶都可以設定為系統管理員。
      • 好不好暂且不说,ta说ta可以用sa连DB的,我假定ta用的是Management Studio。
        • 是,我想Management Studio是用window auth去连DB, 所以只要不disable sa账户一般就不会有问题。不管怎样, 哪怕出于安全考虑,也不要用sa账户做web app的sql server连接账户, 所以不妨新建普通账户试试看。
          • 程序员那有不用SA登录的,只有DBA才不喜欢程序员用, 他自己也老用。
            • 开发时在Management Studio中用sa登录没问题, 但在web app中用sa就不那么好了。
              • 在自己家localhost上有什么问题呢, 谁没事整那么多用户。