Sql Server 2008 to modify the sa password

1 , first with Window login authentication mode in, select the database instance, select properties - Security: Server Authentication option from the "Window Authentication Mode " changed to "SQLServer and Window Authentication mode " . Click OK to close the current Object Explorer.

 

 

 2 ,  re-use Window authentication login, select the tree structure on the left " database " following " Security " option - login --sa , right attributes - the "SQLServer authentication " Enter to set the sa password.

 

 3 ,  restart SQLServer service. Remember, restart the service is not turned off sqlserver2008 then on.

具体方法是在数据库实例上点右键,选择重新启动项即可。最后关闭sql server2008,启动后用sa登陆。

 

 

如果忘记了sa的登录密码,可以先用windows身份认证登录进去,然后新建查询,输入命令:

EXECUTE sp_password NULL,'输入新密码','sa'

设置sa新的密码,然后就可以用sa用户名进行SQL Server登录了。

另外,在获得管理员权限的情况下,可以用命令行添加SQL用户、先建立一个c: est.qry文件,内容如下:

exec master.dbo.sp_addlogin test,123

EXEC sp_addsrvrolemember test, sysadmin

然后在DOS下执行:cmd.exe /c isql -E /U alma /P/ic: est.qry

发布了53 篇原创文章 · 获赞 174 · 访问量 14万+

Guess you like

Origin blog.csdn.net/zzx2016zzx/article/details/88973856