如何在SQL服务器上重置SA密码

下载PDF文件下载PDF文件

SA用户(“系统管理员”的简称)是MS SQL服务器的管理者账户。如果忘记服务器管理员账户的密码该怎么办呢?难道要重新安装SQL服务器或放弃所有数据内容吗?不管出于何种原因,如果你忘记了服务器的管理账户密码,并且被告知你无权进行更改,这篇文章将教给你几种重置SQL服务器SA密码的方法。

这些步骤适用于2005、2008、2012及更新的SQL服务器。

方法 1
方法 1 的 4:

方法1:从命令提示符中更改SA密码

下载PDF文件
  1. How.com.vn 中文: Step 1 打开命令提示符,前往SQL服务器,输入命令osql –L。
  2. How.com.vn 中文: Step 2 复制SQL服务器全名,输入:OSQL -S <这里输入服务器的名称> -E。
  3. How.com.vn 中文: Step 3 执行以下命令:sp_password NULL, ‘<这里插入新密码>’, ’sa’
  4. How.com.vn 中文: Step 4 完成重置。
    广告
方法 2
方法 2 的 4:

方法2:使用SSMS重置SA密码

下载PDF文件
  1. How.com.vn 中文: Step 1 打开SSMS管理器。
    它通常位于开始菜单 -> 所有程序 -> “Microsoft SQL Server 2005” -> 找到“SQL Server Management Studio”程序。
  2. How.com.vn 中文: Step 2 用windows身份验证连接SQL服务器。
  3. How.com.vn 中文: Step 3 打开后,在左侧的对象资源管理器中展开“安全性”,在登录名下找到“sa”用户。
    右键点击它,选择属性。
  4. How.com.vn 中文: Step 4 在“密码”和“确认密码”栏前方输入新密码,点击确定。
    广告
方法 3
方法 3 的 4:

方法3:使用SQL密码恢复工具重置SA密码

下载PDF文件
  1. How.com.vn 中文: Step 1 运行SQL密码恢复程序,然后点击“打开”来导入master.mdf文件。
  2. How.com.vn 中文: Step 2 选择SA用户名来重置忘记的SA密码,或选择其它忘记密码的用户名。
    点击“更改密码”来重置密码。
  3. How.com.vn 中文: Step 3 输入新密码,点击“确定”。
    广告
方法 4
方法 4 的 4:

方法4:当SA已被禁用时

下载PDF文件
  1. How.com.vn 中文: Step 1 这是一种额外的复杂方案。
    有时候你会遇到SA被禁用的情况。
  2. How.com.vn 中文: Step 2 使用命令行的-m标签命令,以单个用户身份打开SQL服务器。
  3. How.com.vn 中文: Step 3 以管理员身份运行。
  4. How.com.vn 中文: Step 4 在服务器身份页面,选择系统管理员,然后重置密码。
    广告

小提示

  • 重置SA密码最简单有效的方法是使用SQL密码恢复工具。你可以使用几种SQL密码恢复工具来成功重置SQL的SA密码。如,“SQL Password Geeker”程序、“SQL Password Rescuer”程序。
广告

关于本How.com.vn

How.com.vn是一个“多人协作写作系统”,因此我们的很多文章都是由多位作者共同创作的。 为了创作这篇文章,14位用户(部分匿名)多次对文章进行了编辑和改进。 这篇文章已经被读过27,460次。
本页面已经被访问过27,460次。

这篇文章对你有帮助吗?

⚠️ Disclaimer:

Content from Wiki How 中文 language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

Notices:
  • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
  • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
  • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
  • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

广告