Sql server 账号被锁住:"the account is currently locked out. The system administrator can unlock it."的解决办法(转载)
今天遇到的问题比较有意思。首先是很久没有打开测试数据库了,今天打开,使用service程序测试的时候出现下面的错误提示:
Message: System.Data.SqlClient.SqlException: Login failed for user 'dcp_prod'. Reason: The password of the account has expired.
很明显,这个是因为密码失效了,dcp_prod这个账户使用了密码失效策略,打开数据库查看这个账户的属性,果然,Enforce password policy和Enforce password expiration这两个属性被选中了。

现在只需要重新设置一下密码就可以了。但是之后又出现了一个错误,提示如下:
System.Data.SqlClient.SqlException: Login failed for user 'dcp_prod' because the account is
currently locked out. The system administrator can unlock it.
这是什么原因呢,locked out是锁住了,然后使用administrator站好去解锁,字面意思是这样的,照着提示区做,再次打开账户属性。

(这里是回复正常之后的状态,默认是灰色不可用的)
点击Status标签,果然Login is locked out属性被选中,取消选中,点击OK,回到程序中。奇怪了,还是上面的locked out提示,打开属性查看,这个属性又一次被选中了。这样连续来回了好几次都是这样,开始纳闷了。后来在网上查,网上说有其他用户尝试连接数据库,我恍然大悟,是那个service程序在跟我争夺数据库。这个service程序每3秒钟会连接一次数据库,进行相应的操作,在这中间如果尝试修改密码,账户会被锁定的。我Administrator tool->service中关掉程序,修改密码,重新打开程序,这个错误就消失了。
PS:如果Sql server账号因为密码输错,尝试过多次登录,也会导致Sql server账号locked out,原文如下:
Login failed for user 'sa' because the account is currently locked out. The system administrator can unlock it. (Microsoft SQL Server, Error: 18486)
SQL server has local password policies. If policy is enabled which locks down the account after X number of failed attempts then the account is automatically locked down.This error with 'sa' account is very common. sa is default administartor login available with SQL server. So there are chances that an ousider has tried to bruteforce your system. (This can cause even if a legitimate tries to access the account with wrong password.Sometimes a user would have changed the password without informing others. So the other users would try to lo)
You can unlock the account with the following options (use another admin account or connect via windows authentication)
1.Alter account & unlock
ALTER LOGIN sa WITH PASSWORD='password' UNLOCK
2.Use another account
Almost everyone is aware of the sa account. This can be the potential security risk. Even if you provide strong password hackers can lock the account by providing the wrong password. ( You can provide extra security by installing firewall or changing the default port but these measures are not always practical). As a best practice you can disable the sa account and use another account with same privileges.
ALTER LOGIN sa DISABLE
You can edit the lock-ot options using gpedit.msc( in command prompt type gpedit.msc and press enter). Navigate to Account Lokout policy as shown in the figure(这说明sql server账号会被锁定的最大失败登录次数,是在windows操作系统的组管理策略中设定的)
Sql server 账号被锁住:"the account is currently locked out. The system administrator can unlock it."的解决办法(转载)的更多相关文章
- SQL点滴8—the account is currently locked out. The system administrator can unlock it.
原文:SQL点滴8-the account is currently locked out. The system administrator can unlock it. 今天遇到的问题比较有意思. ...
- the account is currently locked out. The system administrator can unlock it.
今天遇到的问题比较有意思.首先是很久没有打开测试数据库了,今天打开,使用service程序测试的时候出现下面的错误提示:Message: System.Data.SqlClient.SqlExcept ...
- [转载]SQL Server 2008 R2安装时选择的是windows身份验证,未选择混合身份验证的解决办法
安装过程中,SQL Server 数据库引擎设置为 Windows 身份验证模式或 SQL Server 和 Windows 身份验证模式.本文介绍如何在安装后更改安全模式. 如果在安装过程中选择&q ...
- Sql Server 备份还原失败错误ERROR:3145(备份集中的数据库备份与现有的数据库不同)及解决办法
SQL Server备份文件bak,备份后还原出现错误3145,备份集中的数据库备份与现有的 'xxx' 数据库不同. 解决办法如下: 1,新建一个与现有数据库重名的数据库. 如果您不知道数据库名称, ...
- 安装SQL Server出现在创建窗口句柄之前,不能在控件上调用 Invoke 或 BeginInvoke的错误解决办法
以下是错误报告: 标题: SQL Server 安装程序失败. ------------------------------ SQL Server 安装程序遇到以下错误: 在创建窗口句柄之 ...
- 安装SQL Server 2016出错提示:需要安装oracle JRE7 更新 51(64位)或更高版本完美解决办法
错误提示原因:安装时检测出电脑没有安装JDK,而且是版本7(其他版本不行) 解决方法:先进下面这个网站安装JDK,安装好后配置环境变量,然后重新安装SQL Server 2016即可 http://w ...
- 【转】T-SQL查询进阶—理解SQL Server中的锁
简介 在SQL Server中,每一个查询都会找到最短路径实现自己的目标.如果数据库只接受一个连接一次只执行一个查询.那么查询当然是要多快好省的完成工作.但对于大多数数据库来说是需要同时处理多个查 ...
- SQL Server中的锁的简单学习
简介 在SQL Server中,每一个查询都会找到最短路径实现自己的目标.如果数据库只接受一个连接一次只执行一个查询.那么查询当然是要多快好省的完成工作.但对于大多数数据库来说是需要同时处理多个查询的 ...
- sql server行级锁,排它锁,共享锁的使用
锁的概述 一. 为什么要引入锁 多个用户同时对数据库的并发操作时会带来以下数据不一致的问题: 丢失更新 A,B两个用户读同一数据并进行修改,其中一个用户的修改结果破坏了另一个修改的结果,比如订票系统 ...
随机推荐
- 使用 GMap.NET 实现添加标注、移动标注功能。(WPF版)
前言 在WPF嵌入地图,有两种方式: 浏览器方式:控件方式. 1)浏览器方式就是使用浏览器控件WebBrowser,设置好网址就行了.这种方式与地图的交互不太直接,需要懂html.javascript ...
- java命令行指定log4j2
java -Dlog4j.configurationFile=directory/file.xml
- linux-centos使用 wget命令获取jdk
1, 首先去官网看下地址是否变化了 2, 然后输入以下命令即可 wget --no-check-certificate --no-cookies --header "Cookie: orac ...
- php实现请求分流
一个请求,同时分发到多个服务器, 正常的是: A ============> B 现在想实现的是: --------------> C A ======> B ----- ...
- C#输出26个大写字母
C#输出26个大写字母,较快的方法:
- JavaScript 日期多加一天 方法
今天查看项目发现有出bug,由于未了符合sql语句的要求,前台网页显示的时候传到后台的时候要+1天, 网上查看了别人写的,发现多多少少有点漏洞,经过我自己总结,写出了达到了我要求的 var str = ...
- [日常] Go语言圣经--并发的web爬虫
两种: crawler.go package main import ( "fmt" "links" //"log" "os&qu ...
- [android] 帧动画和补间动画
逐帧显示一张图片,连起来成为动画 在res/drawable/目录下,创建一个xxx.xml的文件 添加<animation-list>节点,设置是否循环android:oneshot:” ...
- 《码出高效 Java开发手册》第二章 面向对象
码云地址: https://gitee.com/forxiaoming/JavaBaseCode/tree/master/EasyCoding 第2章 面向对象 Object-Oriented Pro ...
- MongoDB的web可视化管理工具
现在许多应用都使用MongoDB存储大量的业务数据,MongoDB基于文档式的存储,在大数据行业的应用还是很普遍的.MongoDB的客户端工具也很多,基于web的却不多,国产的就更少了,下面介绍的是一 ...