1、首先停止所有与SQLServer相关的服务
net stop "SQL Server Integration Services"
net stop "SQL Server FullText Search (MSSQLSERVER)"
net stop "SQL Server Agent (MSSQLSERVER)"
net stop "SQL Server Analysis Services (MSSQLSERVER)"
net stop "SQL Server Reporting Services (MSSQLSERVER)"
net stop "SQL Server Browser"
net stop "SQL Server (MSSQLSERVER)"
2、在命令行提示符下执行
--SQL2005
cd C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn
sqlservr.exe -m
如果是命名实例执行sqlservr.exe -m -s<Instance Name>
3、启动另一个命令行窗口,执行 sqlcmd -E
4、在此窗口下执行下面的命令
create login [builtin\administrators] from windows
go
exec sp_addsrvrolemember [builtin\administrators], [sysadmin]
go
ALTER LOGIN sa WITH PASSWORD='***'
go
shutdown
go
5、关闭2个命令行窗口,启动sqlserver,一切Ok
net start "SQL Server Integration Services"
net start "SQL Server FullText Search (MSSQLSERVER)"
net start "SQL Server Agent (MSSQLSERVER)"
net start "SQL Server Analysis Services (MSSQLSERVER)"
net start "SQL Server Reporting Services (MSSQLSERVER)"
net start "SQL Server Browser"
net start "SQL Server (MSSQLSERVER)"
联系客服