问题
- SQL Server was installed on the local PC by User1.
- User1 has now left the company and a new account on the PC was created called User2.
- User2 cannot access the local SQL Server installation.
Is it possible for User2 to access the local SQL Server without reinstalling?
Here is the error:
Cannot connect to mydatabasename.
Login failed for user 'myuser2name'. (.Net SqlClient Data Provider)
Server Name: mydatabasename
Error Number: 18456
Severity: 14
State: 1
Line Number: 65536
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=18456&LinkId=20476
回答1:
The easiest way would be to log in via the "sa" account but I expect you don't have the password to this or it isn't enabled.
If you start the server in single-user mode you will be able to add additional users without reinstalling.
This MSDN page outlines all the steps but in brief they are
- Stop all services for that instance (including Sql Agent and Integration services) using "Sql Server Configuration Manager"
- Open up the properties window for the Sql Server instance you need to modify.
- Add an additional startup parameter "-m"
- Start the service (make sure you only start the Sql Server service)
- Start SSMS using "Run as Administrator"
- Connect to server using windows auth.
- Add login.
- Remove -m parameter from service and restart all services stopped above.
来源:https://stackoverflow.com/questions/28090747/local-sql-server-installed-by-other-user-account-how-to-access-from-new-user-ac