MSSQL最常见报错解决方法汇总(mssql常见报错)
一、MSSQL最常见报错解决方法汇总
1、报错:Cannot open database “” requested by the login. The login failed
解决:登录SqlServer时用的帐号被锁定,可以尝试用sa帐号进行登录,如果sa用户被禁止登录,那么可以尝试修改登录凭据:
USE master
GO
ALTER LOGIN sa WITH PASSWORD = ‘新密码’
2、报错:The login is from an untrusted domain and cannot be used with integrated authentication
解决:打开MSSQL configuration manager,修改SQL server network configuration,选择protocols for
MSSQLServer,在左右窗口中选择TCP/IP,右击TCP/IP,点击属性,在弹出的对话框中,在
IP Addresses选项卡中,把Enable改为yes,TCP Dynamic Ports置为空,在TCP端口输入1433
3、报错:A connection was successfully established with the server,but then an error occurred during the login process
解决:首先,先确认服务器是否开启了远程连接的功能,如果没有开启,就需要手动去开启;其次,针对报错,需要检查SQL server实例的设置,打开MSSQL设置工具,定位到安全选项,并把Windows身份验证修改为 mixed;最后,重新启动SQL service
4、报错:The SELECT permission was denied on the object
解决:需要检查此用户是否有该表的权限,如果没有权限,可以使用如下命令为用户添加权限:
GRANT SELECT ON object TO user
5、报错:Error 5123 when Attach MDF File
解决:如果出现报错,最常见的原因就是MDF文件被SQL server程序的访问权限所限制,可以尝试修改文件的权限:
Right click MDF file → Properties → Security → Add → Select user/ Administrator →Check names → User MSSQLServie->Full control → Apply
综上,MSSql中最常见的报错及解决方法汇总如下:
1、Cannot open database “” requested by the login. The login failed – 用sa帐号进行登录,如果sa用户被禁止登录,ALTER LOGIN sa
2、The login is from an untrusted domain and cannot be used with integrated authentication – 修改SQL server network configuration
3、A connection was successfully established with the server,but then an error occurred during the login process – 确认服务器是否开启了远程连接的功能,及修改SQL server实例的设置,重新启动SQL service
4、The SELECT permission was denied on the object – 检查此用户是否有该表的权限,GRANT SELECT
5、Error 5123 When Attach MDF File – 修改文件的权限:Right click MDF file → Properties → Security